Better example that does not use attachment
This commit is contained in:
parent
696b5a1f45
commit
ab1a598534
@ -42,19 +42,17 @@ package org.jboss.netty.channel;
|
|||||||
* public class MyHandler extends {@link SimpleChannelHandler}
|
* public class MyHandler extends {@link SimpleChannelHandler}
|
||||||
* implements {@link LifeCycleAwareChannelHandler} {
|
* implements {@link LifeCycleAwareChannelHandler} {
|
||||||
*
|
*
|
||||||
* private {@link ChannelHandlerContext} ctx;
|
* <b>private {@link ChannelHandlerContext} ctx;</b>
|
||||||
*
|
*
|
||||||
* public void beforeAdd({@link ChannelHandlerContext} ctx) {
|
* public void beforeAdd({@link ChannelHandlerContext} ctx) {
|
||||||
* this.ctx = ctx;
|
* <b>this.ctx = ctx;</b>
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* {@code @Override}
|
* public void login(String username, password) {
|
||||||
* public void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} evt) {
|
* {@link Channels}.write(
|
||||||
* ctx.setAttachment(evt.getMessage());
|
* <b>this.ctx</b>,
|
||||||
* }
|
* {@link Channels}.succeededFuture(<b>this.ctx</t>.getChannel()),
|
||||||
*
|
* new LoginMessage(username, password));
|
||||||
* public Object getLastReceivedMessage() {
|
|
||||||
* return ctx.getAttachment();
|
|
||||||
* }
|
* }
|
||||||
* ...
|
* ...
|
||||||
* }
|
* }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user