users@jersey.java.net

[Jersey] Re: returning default jersey responses as json

From: Bobby Bissett <bbissett_at_gmail.com>
Date: Wed, 18 Nov 2015 15:58:41 -0500

On Wed, Nov 18, 2015 at 2:41 PM, Jennifer Sears <jsears_at_galtech.net> wrote:

> Have you tried using a custom ObjectMapper? It sounds like you need to
> map your exceptions like described at the link below.
>

Thanks for the quick response. My exceptions (meaning anything I throw or
catch) are all ok since I can throw a custom Exception that can generate
the JSON. It's the cases where my code isn't even called that I don't know
how to handle.

For instance, when someone hits http://myserver/this_is_not_a_real_url I
don't know if Jersey generates an exception internally or if it just sees
that the URI doesn't match anything and responds with the 404. If so, then
maybe the mapping would work. I'll try that and just map to Exception to
see if something useful pops out.

Cheers,
Bobby