users@jersey.java.net

Re: [Jersey] ExceptionMapping - 500 or still no message

From: Marc Hadley <marc.hadley_at_oracle.com>
Date: Wed, 14 Apr 2010 10:16:34 -0400

Exception handing is specified here:

https://jsr311.dev.java.net/nonav/releases/1.1/spec/spec3.html#x3-280003.3.4

If you are using an ExceptionMapper then its your responsibility to make sure that the status returned in the Response is the correct one, IOW you need to copy it out of the exception you receive.

Marc.

On Apr 14, 2010, at 9:38 AM, Daniel Manzke wrote:

> Hi,
>
> I developed a Service with the help of JAX-RS and I'm fighting a little bit with the Exception handling. I searched through the Mail-List and saw that there was some similiar problem and it was fixed. Maybe I'm just doing something wrong. ;)
>
>
> I saw that when I'm using the WebApplicationException and just passing a Status, I'll get the error page with the right code, but it's not possible to write something in the message field.
> So I created a Exception which inherits from WebApplicationException and wraps up my thrown Exceptions. The Stacktrace will be displayed, but not the Error-Page.
>
> So I did the next try with the ExceptionMapper. This will end in an Error-Page with 500 and the "root causes" message, but the passed StatusCode is ignored.
>
>
>
> What I want to do?
> - throw a Exception with a Status Code
> - display the Error-Page with the right Status Code and the Stacktrace
>
>
> Any idea?
>
>
> Thanks,
> Daniel :)