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

Reply via email to