users@jersey.java.net

[Jersey] Best place to ResourceConfig?

From: Tom Samplonius <tom_at_samplonius.org>
Date: Sat, 19 Oct 2013 19:00:43 -0700

  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. 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