Re: Accessing jax-rs (CXF) MessageContext outside service class (in aspect) in Spring (2.5)

2009-10-23 Thread Adrian M

Thanks all for the suggestions.

I ended up going the PhaseInterceptorChain route:

In spring config (injected as Message or even Map type)





adrian


dkulp wrote:
> 
> 
> Easiest is to just grab the raw message:
> 
> PhaseInterceptorChain.getCurrentMessage()
> 
> and pull the stuff off of there.   Would need to use the CXF internal
> names 
> (defined on Message), but that's not a major issue.
> 
> Dan
> 
> 
> 
> On Thu October 22 2009 11:27:34 am Adrian M wrote:
>> Hey All,
>> 
>> I'm trying to access the MessageContext (or WebServiceContext) in an
>> aspect
>> to get access to the HTTPServletRequest for logging purposes. I would
>> like
>> to inject the context like I did for spring-ws but I have not found a way
>>  to do it. Here is what I used for spring-ws:
>> 
>> > class="org.springframework.ws.transport.context.TransportContextHolder"
>> factory-method="getTransportContext" scope="request">
>>  
>>  
>> 
>> I can't use the @Resource annotation on WebServiceContext field/method as
>> I
>> am not in the service (tried anyways with no luck). Instantiating the
>> WebServiceContext (ie new WebServiceContextImpl()) doesn't work either,
>> but
>> supposedly should as this just wraps a threadlocal. I've also tried
>> importing cxf-extension-jaxws.xml and wiring the bean with id
>> org.apache.cxf.jaxws.context.WebServiceContextImpl with no luck (it's not
>> null but doesn't hold anything) Any ideas?
>> 
>> thanks
>> 
> 
> -- 
> Daniel Kulp
> dk...@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Accessing-jax-rs-%28CXF%29-MessageContext-outside-service-class-%28in-aspect%29-in-Spring-%282.5%29-tp26012049p26030115.html
Sent from the cxf-user mailing list archive at Nabble.com.



Accessing jax-rs (CXF) MessageContext outside service class (in aspect) in Spring (2.5)

2009-10-22 Thread Adrian M

Hey All,

I'm trying to access the MessageContext (or WebServiceContext) in an aspect
to get access to the HTTPServletRequest for logging purposes. I would like
to inject the context like I did for spring-ws but I have not found a way to
do it. Here is what I used for spring-ws:


 
 

I can't use the @Resource annotation on WebServiceContext field/method as I
am not in the service (tried anyways with no luck). Instantiating the
WebServiceContext (ie new WebServiceContextImpl()) doesn't work either, but
supposedly should as this just wraps a threadlocal. I've also tried
importing cxf-extension-jaxws.xml and wiring the bean with id
org.apache.cxf.jaxws.context.WebServiceContextImpl with no luck (it's not
null but doesn't hold anything) Any ideas?

thanks

-- 
View this message in context: 
http://www.nabble.com/Accessing-jax-rs-%28CXF%29-MessageContext-outside-service-class-%28in-aspect%29-in-Spring-%282.5%29-tp26012049p26012049.html
Sent from the cxf-user mailing list archive at Nabble.com.