passing data between ChannelHandlers
Norman Maurer
norman.maurer at googlemail.com
Fri Oct 21 03:36:59 EDT 2011
I was using it before in a project but remoted it in favor of
ChannelHandlerContext.setAttachment(..).
But it worked quited fine for me. You can see the old code here:
http://svn.apache.org/viewvc/james/protocols/tags/protocols-1.5/impl/src/main/java/org/apache/james/protocols/impl/AbstractChannelUpstreamHandler.java?view=markup
Bye,
Norman
Ps: What does not work for you ?
2011/10/21 Matt DeLuco <list_usr at spacebox.net>:
> Where can I find some examples of ChannelLocal in use?
> I'm not getting the results I expect, but I don't think I'm using it
> correctly either.
> MD
>
> On Sun, Oct 16, 2011 at 7:14 AM, Norman Maurer
> <norman.maurer at googlemail.com> wrote:
>>
>> 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
>> >
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
> _______________________________________________
> 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