users@jersey.java.net

[Jersey] Re: returning default jersey responses as json

From: Bobby Bissett <bbissett_at_gmail.com>
Date: Wed, 18 Nov 2015 19:51:26 -0500

On Wed, Nov 18, 2015 at 5:56 PM, Joe Mocker <jmocker_at_tremorvideo.com> wrote:

> If its not reaching your code, and so I'm guessing not even reaching
> Jersey, you'll probably have to add some custom error pages to your web.xml
> -
>

No, it's definitely in the Jersey code. If nothing else, a DELETE call to
one of my resources that doesn't support DELETE results in a 405 that lists
the actions that *are* possible (which only the Jersey annotation processor
knows). I just don't have any code for that action, so none of my code is
called. To expand on my earlier example, I have /api/<etc>/* mapped to the
Jersey servlet, and a URI that starts with that but doesn't match any of my
paths gets into the Jersey servlet, but of course doesn't call my code
since I don't have anything that matches.

It looks like Jersey 2.X has specifically what I'm looking for in its
server filter objects; am trying to figure out how to do the same thing
with 1.X, unless there's some other setting I don't know about in Jersey
that does the same thing for me.

Thanks,
Bobby