users@jersey.java.net

[Jersey] Name Binding in jersey 2

From: Matt Hauck <mhauck_at_mokafive.com>
Date: Tue, 4 Mar 2014 09:53:05 -0800

Hello! I recently upgraded to jersey2 and would like to take advantage of the new @NameBinding meta-annotation. It appears that this only works on filters and interceptors. Is that true? I would like to use it for things like MessageBodyWriters and ExceptionMappers as well, as different segments of our app require a similar kind of formatting that needs to be consistent, whereas other legacy portions of our app need to still be generated in the older fashion and shouldn’t be affected by the new configuration.

Is there a way to do this with name binding?

Another problem I see with name binding is that it only appears to work when applied to a resource method, and not to a resource class? Is that true or am I mistaken? This seems like a bit of a blunder since it would be quite a pain to have to keep track of whether a particular annotation is applied to every single method in a resource class.

Thanks.

--
Matt Hauck