Isn't there an issue of thread safety here?  When I initially set up my 
provider it's just a singleton in my spring config.  Is there something going 
on behind the scenes that makes each provider call thread safe?

Thanks,

Jeff

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]] 
Sent: Wednesday, September 22, 2010 4:27 PM
To: [email protected]
Subject: Re: HttpServletRequest Access in a JAX-RS Provider

Hi

On Wed, Sep 22, 2010 at 8:22 PM, Puro, Jeff (HBO-NS) <[email protected]>wrote:

> I am attempting to create a Provider that implements the 
> MessageBodyWriter interface.  I would like my provider to use XStream 
> to convert the passed in object to XML and then perform an XSLT 
> transformation on the xml before writing the results to the 
> OutputStream.  This is easy enough to do, but I would also like to be 
> able to pass in additional parameters relating to the request and perhaps 
> anything else as it relates to the CXF message exchange.
>  Is there any way to do this?  It seems that the method signature for 
> the writeTo method does not provide a way to access the request etc...
>
>
You can have

@Context HttpServletRequest request;
@Context UriInfo info;
@Context HttpHeaders headers;

injected into the provider. You might want to have CXF specific MessageContext 
injected - which will let you get to all of the above contexts

cheers, Sergey


> Regards,
>
> Jeff
>
> ---------------------------------------------------------------------
> This e-mail is intended only for the use of the addressees.  Any 
> copying, forwarding, printing or other use of this e-mail by persons 
> other than the addressees is not authorized.  This e-mail may contain 
> information that is privileged, confidential and exempt from 
> disclosure. If you are not the intended recipient, please notify us 
> immediately by return e-mail (including the original message in your 
> reply) and then delete and discard all copies of the e-mail.
>
> Thank you.
>
> ---------------------------------------------------------------------
>
>

Please consider the environment before printing this e-mail

---------------------------------------------------------------------
This e-mail is intended only for the use of the addressees.  Any copying, 
forwarding, printing or other use of this e-mail by persons other than the 
addressees is not authorized.  This e-mail may contain information that is 
privileged, confidential and exempt from disclosure. If you are not the 
intended recipient, please notify us immediately by return e-mail (including 
the original message in your reply) and then delete and discard all copies of 
the e-mail. 

Thank you.

---------------------------------------------------------------------

Reply via email to