Hi Eamonn:

Thanks your reply. You are right!
But in my case, I need to transfer Runtime Exception too.
How to transfer it as WebApplicationException if Runtime Exception be
thrown?
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--tp24952068p24962785.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to