passing data between ChannelHandlers
Matt DeLuco
list_usr at spacebox.net
Sat Oct 15 22:34:40 EDT 2011
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
>
More information about the netty-users
mailing list