users@jersey.java.net

Re: [Jersey] Structured Exception handling

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 13 May 2008 16:07:05 -0400

JSR 311 API v0.8 introduces a new type of provider to address this
issue:

https://jsr311.dev.java.net/nonav/releases/0.8/javax/ws/rs/ext/ExceptionMapper.html

AFAIK, support for this isn't yet available in Jersey but it will
appear as part of the 0.8 release.

Marc.

On May 13, 2008, at 9:24 AM, David Esposito wrote:

> Hello All,
>
> I am trying to gracefully handle an Exception that is being raised
> by the framework. (i.e. a failure to parse the request body into the
> appropriate Java object (JAXB) due to schema errors). I have looked
> through the source of WebApplicationImpl and see that the mechanism
> for catching a WebApplicationException
> (onExceptionWithWebApplication) is hard-coded to generate a text/
> plain response with the entire stack trace.
>
> Is there a work item to allow an application to register an
> exception listener/handler so that I can decide how I want to handle
> the exception and generate the appropriate Response? (a la the
> Restlet.org org.restlet.service.StatusService)
>
> Adding a servlet filter doesn't seem appropriate since I will have
> lost the context of the Exception by the time I reach the filter.
>
> Thanks,
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.