passing data between ChannelHandlers
Norman Maurer
norman.maurer at googlemail.com
Sun Oct 16 07:14:26 EDT 2011
You can set anything you want as attachment. But it's only visible in
the same handler....
If you want to share stuff between handler you should checkout ChannelLocal
Bye
Norman
2011/10/16, Matt DeLuco <list_usr at spacebox.net>:
> Before composing this message I had noticed
> ChannelHandlerContext.setAttachment(Object) and getAttachment(). But
> for some reason I came to the conclusion that it wasn't intended for
> what I want to do.
>
> I came to that conclusion in part because I found it strange that it's
> only possible to set one attachment, rather than being able to attach
> a set (or map) of objects. Could I just attach a map to the context
> and store whatever I want in that map, to pass objects between
> ChannelHandlers?
>
> MD
>
>
> On Sat, Oct 15, 2011 at 9:42 PM, Matt DeLuco <list_usr at spacebox.net> wrote:
>> Is it possible to pass data between ChannelHandlers, or store data
>> somewhere that the handlers in a specific pipeline/channel can access
>> throughout the lifetime of the request?
>>
>> For example, I have my own class for dealing with http cookies,
>> "CookieMap". I'd like to have a SimpleChannelHandler that creates a
>> CookieMap to be used by handlers further upstream, and then sets the
>> cookies in the CookieMap on the response on their way back downstream.
>>
>> MD
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
More information about the netty-users
mailing list