users@jersey.java.net

Re: [Jersey] Configuring Exception Handling

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 16 Sep 2009 14:35:02 -0400

Sounds like the standard ExceptionMapper will do what you want:

https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/ext/ExceptionMapper.html
https://jsr311.dev.java.net/nonav/releases/1.0/spec/
spec3.html#x3-510004.4

Marc.

On Sep 16, 2009, at 1:58 PM, Stephen Duncan Jr wrote:

> I know there's been prior discussion about various extensible error-
> handling features to be added to Jersey, but I couldn't figure out
> if there's anything available right now that I could use to meet my
> needs:
>
> I want to log all uncaught exceptions (non
> WebApplicationException's) & I want the response for those
> exceptions to be text/plain with just the error message, not the
> stack-trace that is currently returned. The default of 500 as the
> status is fine.
>
> Is there a way to get this behavior? I'm having trouble finding
> documentation on filters or other techniques that might apply here...
>
> --
> Stephen Duncan Jr
> www.stephenduncanjr.com