You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Pratyush Chandra <co...@yahoo.com> on 2011/05/13 14:25:53 UTC

Re: Accessing MessageContext and http headers across service layers

Is PhaseInterceptorChain.getCurrentMessage() thread safe ?

Also if I do something like,

PhaseInterceptorChain.getCurrentMessage().setContent(String.class,"Myname"); 

i.e set some data in in-interceptor...will be threadsafe and global to
access from my code flow..across from wherever i call ?

PhaseInterceptorChain.getCurrentMessage().getContent(String.class); 






--
View this message in context: http://cxf.547215.n5.nabble.com/Accessing-MessageContext-and-http-headers-across-service-layers-tp4273158p4392956.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Accessing MessageContext and http headers across service layers

Posted by Daniel Kulp <dk...@apache.org>.
On Friday, May 13, 2011 3:42:12 PM Pratyush Chandra wrote:
> Hmm..then a good way to have kind of global data in one service request...
> Thanks a lot !

Yep.  That's pretty much exactly what it's there for.   That said, be careful 
what things you set in the "setContent".   That is what CXF uses for the 
content as it transforms the content from form to form during the 
interceptors.    Thus, things like streams and readers and such are already 
"used".  You likely should use msg.setProperty(...) instead using your own 
defined keys.

Dan


> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Accessing-MessageContext-and-http-headers-
> across-service-layers-tp4273158p4394104.html Sent from the cxf-user mailing
> list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Accessing MessageContext and http headers across service layers

Posted by Pratyush Chandra <co...@yahoo.com>.
Hmm..then a good way to have kind of global data in one service request...
Thanks a lot !

--
View this message in context: http://cxf.547215.n5.nabble.com/Accessing-MessageContext-and-http-headers-across-service-layers-tp4273158p4394104.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Accessing MessageContext and http headers across service layers

Posted by Sergey Beryozkin <sb...@gmail.com>.
Yes

On Fri, May 13, 2011 at 1:25 PM, Pratyush Chandra
<co...@yahoo.com> wrote:
> Is PhaseInterceptorChain.getCurrentMessage() thread safe ?
>
> Also if I do something like,
>
> PhaseInterceptorChain.getCurrentMessage().setContent(String.class,"Myname");
>
> i.e set some data in in-interceptor...will be threadsafe and global to
> access from my code flow..across from wherever i call ?
>
> PhaseInterceptorChain.getCurrentMessage().getContent(String.class);
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Accessing-MessageContext-and-http-headers-across-service-layers-tp4273158p4392956.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com