users@jersey.java.net

Re: [Jersey] WebApplicationExceptions with response code >= 500 do not get passed back to the http container

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 16 Apr 2010 15:08:23 +0200

HI Alex,

I now consider this a bug, can you log an issue? (it was also
discussed recently in another thread).

A possible work around: include an exception mapper for
WebApplicationException that just returns the Response from
WebApplicationException.

Paul.

On Apr 16, 2010, at 2:59 PM, Alex Treppass wrote:

> In Jersey, WebApplicationExceptions with response codes < 500 are
> passed to the http container, allowing the http container to
> generate / use a custom error page with our web application's look-
> and-feel and a user-friendly message. We're using <error-page>
> declarations in our Tomcat's web.xml to achieve this.
>
> It seems that WebApplicationExceptions with response code > 500 are
> instead processed by ContainerResponse.onException(Throwable e,
> Response r, Boolean mapped), which generates a Jersey specific error
> page at line 455. The generated error page body is a server-side
> strack trace giving out quite a lot of implementation / internal
> info. This behaviour is preventing us from mapping static custom
> error pages with the server with our application's look and feel for
> http status codes >= 500.
>
> We're using Jersey 1.1.5.
>
> Regards,