Hi

It is thread safe, it is a thread-safe proxy which is injected.

Now, as far as the lifecycle of providers is concerned (body
readers/writers, filters, exception mappers) : at the moment they are
always singletons (in CXF at least), hence thread safe proxies are
injected.
Resource classes can be prototypes though...

If users report some real limitations with providers being singletons
then we can enhance CXF JAX-RS for alternative lifecycles be supported
too. I don't see it being a limitation at the moment... 
 
Cheers, Sergey

-----Original Message-----
From: Mike O'Neil [mailto:[email protected]] 
Sent: 17 December 2009 21:38
To: [email protected]
Subject: Re: How do I access the request URI from an ExceptionMapper?

Sergey,
Unless I am missing something, this solution is not thread safe. Is
there a way to have ExceptionMapper instantiated as a prototype bean?
Otherwise I don't see how this will work properly across more than 1
thread. But maybe I am wrong... looking forward to your clarification
:)

Thanks,
Mike

On Thu, Dec 17, 2009 at 4:31 PM, Henrik Martin
<[email protected]> wrote:
> Thanks Sergey. That worked great. Cheers,
>
> /Henrik
>
> On Thu, 2009-12-17 at 09:33 +0000, Sergey Beryozkin wrote:
>> Hi
>>
>> You can have a
>>
>> @Context
>> private UriInfo uriInfo;
>>
>> or
>>
>> private UriInfo uriInfo;
>> @Context
>> public void setUriInfo(UriInfo uriInfo) {...}
>>
>> declared in your mapper class...
>> cheers, Sergey
>>
>> ----- Original Message -----
>> From: "Henrik Martin" <[email protected]>
>> To: <[email protected]>
>> Sent: Thursday, December 17, 2009 12:14 AM
>> Subject: How do I access the request URI from an ExceptionMapper?
>>
>>
>> > Greetings. I have written a bunch of ExceptionMapper
implementations to
>> > catch a variety of business exceptions in our system and return
them as
>> > a special type of Response object. It works fine, but I need to get
a
>> > hold of the URI from the incoming request to set it in the outgoing
>> > Response. Since the ExceptionMapper interface method toResponse()
only
>> > gives me the actual Exception that was thrown, is there another way
I
>> > can get the URI? Thanks,
>> >
>> > /Henrik
>

Reply via email to