An idea for an annotation-based handler
Tuomas Kiviaho
tuomas.kiviaho at iki.fi
Thu Nov 26 03:11:48 EST 2009
Trustin Lee wrote:
>
> Here's my rough idea about adopting annotation for handler
> implementation.
> ...
> Please let me know what you think.
>
I've been using netty for some time and this is close to what I scribbled in
to help me with channel handler ordering for pipeline. I would be great to
have this provided by Netty.
Trustin Lee wrote:
>
>
> // These replace messageReceived event handler methods.
> @MessageEventHandler
> void handleRequest(MessageEvent<MyMessage> evt);
> @MessageEventHandler
> void handleRequest(HttpRequest request);
> @MessageEventHandler
> void handleChunk(HttpChunk chunk);
>
> // Alternatively, you can ask for more parameter injection.
> @MessageEventHandler
> void handleRequest(Channel channel, HttpRequest request);
> @MessageEventHandler
> void handleChunk(ChannelHandlerContext ctx, HttpChunk chunk);
>
>
I've couple of notes about write requests and message receiving you
described above.
1. Have you considered using return value as indication of
OneToOneDecoder/Encoder behaviour.
2. I noticed also that generics - namely TypeVariable and WildcardType types
- are quite valuable when extending the handler.
--
Tuomas
--
View this message in context: http://n2.nabble.com/An-idea-for-an-annotation-based-handler-tp3969929p4069890.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.
More information about the netty-dev
mailing list