Hi

Also, by default, custom Exceptions with no mappers are propogated to the
container which just replies 500. One can disable it by registering a
'org.apache.cxf.propogate.exception' = false jaxrs property, in which case
you'll get a message from XMLBinding containing thte stack trace. 
Gabo - if you're reading it - it may help in your case too

cheers, Sergey


Sam.Wang wrote:
> 
> Hi Eamonn:
> 
> Thanks your reply. You are right!
> I have added a customized ExceptionMapper to JAXRSServerFactoryBean, and
> it works fine. 
> Thanks, Sam.
> 
> 
> Eamonn Dwyer-2 wrote:
>> 
>> 
>> Hi Sam,
>> maybe you should be throwing a WebApplicationException rather than just
>> an Exception.
>> 
>> There is more information available at
>> http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Exceptionhandling
>> 
>> I think if you want to throw an Exception you could register an Exception
>> Mapper to handle it for JaxRS
>> 
>> Regards
>> Eamonn
>> 
>> 
>>> Date: Thu, 13 Aug 2009 02:49:05 -0700
>>> From: [email protected]
>>> To: [email protected]
>>> Subject: How to get the exception response?
>>> 
>>> 
>>> Hi , 
>>> 
>>> I used the JAXRSServerFactoryBean to publish REST service, but in the
>>> client(javascript code), I can't get response info when server error
>>> happening.
>>> 
>>>     @GET
>>>     @Path("/customers/{id}/")
>>>     public Customer getCustomer(@PathParam("id") String id) throws
>>> Exception{
>>>             if(true)
>>>                     throw new Exception("Error!");
>>> 
>>>             long idNumber = Long.parseLong(id);
>>>             Customer c = customers.get(idNumber);
>>>             return c;
>>>     }
>>> 
>>> In the web browser, I only can get the response code :
>>> 
>>> 500 Internal Server Error
>>>     
>>> but the response info is null:
>>> 
>>> 0 B
>>> 
>>> Can I output the error info/stack to client? and how?
>>> 
>>> Thanks!
>>> Sam
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/How-to-get-the-exception-response--tp24952068p24952068.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>> 
>> _________________________________________________________________
>> What can you do with the new Windows Live? Find out
>> http://www.microsoft.com/windows/windowslive/default.aspx
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-the-exception-response--tp24952068p24970565.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to