On Jan 21, 2010, at 1:03 PM, Cemo Koc wrote:
>
> Hi,
>
> Is there a best practice to return exceptions from resources. I am
> using
> Jersey 1.1.5-ea.
>
Three choices:
1) catch the exception in the resource method code build/return a
response;
2) throw WebApplicationException; or
3) throw any other type of Exception and use an exception mapper.
> It could be great for example forwarding exceptions in different
> servers
> with all stacktrace and resource information like requested
> parameters,
> requested URI etc...
>
I think such behavior is definitely application-specific so you may
need to define ExceptionMapper implementations for the relevant
exceptions if you want to separate that from the resource methods
themselves.
Paul.