users@jersey.java.net

[Jersey] Re: Best place to ResourceConfig?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 5 Nov 2013 18:27:19 +0100

If you extend the ResourceConfig, you can invoke the register method in your constructor. The code in the documentation can be used in non-servlet deployments (e.g. when you deploy to a grizzly container). However both approaches (extending as well as not extending) are valid and should produce the same result.

Marek

On 21 Oct 2013, at 02:10, Tom Samplonius <tom_at_samplonius.org> wrote:

>
> I'm trying to configure DIGEST auth on my REST resources. I'm following the "14.1.2.2. Securing JAX-RS resources with annotations" section in the user guide, and it includes this:
>
> final ResourceConfig resourceConfig = new ResourceConfig(MyResource.class);
> resourceConfig.register(RolesAllowedDynamicFeature.class);
>
> This appears odd, as normally you would have an application class that extends ResourceConfig, and then register stuff there, right? Where is the above code intended to go? Is using an application class that extends ResourceConfig, the best approach?
>
>
>
> Also, the example in the User Guide appears to contain an error. As it uses "MyResource.class", but the class is defined as "public class Resource".
>
>
> Tom
>
>
>
>