Hi Sergey,

  Sory to botter you again but I think I my poor command of the english
language is making my explanations about my problems much more complicated
than the problem itself. So I develop a unit test with a simplified but
similar scenario. Thanks a lot for your help!


  Ats,
  Osvaldo Pina.

On Thu, Sep 29, 2011 at 8:33 AM, Sergey Beryozkin <sberyoz...@gmail.com>wrote:

> Hi
>
> ResponseReader is still the provider you need to register.
> I have a test which catches ServerWebApplicationException and
> then does ex.toErrorObject(Book.class).
> ResponseReader has to be registered once but you can set an expected class
> on it every time you need to read from Response, directly or indirectly
>
> Cheers, Sergey
>
>
>
> On 28/09/11 17:31, Osvaldo Pina wrote:
>
>>   Hi,
>>
>>   Maybe the approach to my problem is driving me to a wrong path. We are
>> in
>> the process of changing all integration components from EJB2 to Rest. In
>> the
>> server side when a component exception is thrown I look at the accept
>> header
>> that was sent by the client to see if the client is a regular web browser
>> or
>> my rest client. If it was the web browser I render the response as a HTML
>> error page but if It was my rest client (the rest client accepts
>> application/xml for regular response and
>> application/bc-serialized-**exception+xml for error response) I render
>> the
>> error as a xml with the java exception serialized in a base 64 format. In
>> the server I have a ExceptionMapper that do this exception to HTML or
>> application/bc-serialized-**exception+xml translation. In the client i
>> get the
>> ServerWebApplicationException and use the method toErrorObject to
>> translate
>> the application/bc-serialized-**exception+xml back into the original
>> exception. When I discorered the ResponseExceptionMapper that was designed
>> to do this task on the client side I decided to give it a try, but the
>> Response object in ResponseExceptionMapper is a InputStream. So the
>> question
>> about message context was to give a way to acess the Providers instance in
>> order to query for the responseReader for
>> application/bc-serialized-**exception+xml ( whitch I think will return a
>> MessageBodyReader for xml). Summarizing the problem: In the
>> ResponseExceptionMapper I have to translate the exception which is encoded
>> as application/bc-serialized-**exception+xml into the corresponding java
>> object.
>> Sorry by the long email!!!!
>>
>> thanks a lot,
>> Osvaldo Pina.
>>
>> On Tue, Sep 27, 2011 at 7:05 PM, Sergey Beryozkin<sberyoz...@gmail.com**
>> >wrote:
>>
>>  Hi
>>>
>>> Do you need some information about the outbound message in your
>>> ResponseExceptionMapper ? It has a Response in parameter that gives all
>>> the
>>> info about the response message
>>>
>>> Cheers, Sergey
>>>
>>>
>>> On 26/09/11 21:51, Osvaldo Pina wrote:
>>>
>>>    Hi,
>>>>
>>>>   I´m trying to inject a @Context for a MessageContext into a
>>>> ResponseExceptionMapper and I always get null for the MessageContext
>>>> field.
>>>> Taking a look at the code I found that the code in ProviderFactory class
>>>> is
>>>> not calling injectContexts into responseExceptionMappers. This is
>>>> correct?
>>>>
>>>>
>>>>   Ats,
>>>>   Osvaldo Pina.
>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to