users@jersey.java.net

Re: [Jersey] Re: _at_RolesAllowed

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Jun 2010 06:42:46 +0200

Hi Christopher,

Does this mean you have solved your Guice configuration issues?


On Jun 9, 2010, at 1:07 AM, Christopher Piggott wrote:

> Seems like I can't do this, the PROPERTY_CONTAINER_REQUEST_FILTERS
> seem to need to have a default constructor... unless somebody knows
> some trick.
>
>

Can you share some code?

The registered AuthenticationFilter class will be treated as a
component so injection should be possible. Are there any errors in the
logs related to instantiation of that class?

Note that Jersey's support for @RolesAllowed is only supported on
resource classes.

Paul.


>
>
>
> On Tue, Jun 8, 2010 at 4:48 PM, Christopher Piggott <cpiggott_at_gmail.com
> > wrote:
>> My configuration is
>> grizzly-servlet-webserver 2.0.0-M3 (and required friends)
>> jersey-server 1.2
>> jersey-guice 1.2
>> guice 2.0
>>
>>
>>
>> I'm not doing much to initialize it. My ServletAdapter is
>> configured with:
>>
>>
>> sa
>> .addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
>> AuthenticationFilter.class.getName());
>>
>> sa
>> .addInitParameter(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES,
>> RolesAllowedResourceFilterFactory.class.getName());
>> sa.addServletListener(ProtobufServletConfig.class.getName());
>> sa.addFilter(new GuiceFilter(), "guiceFilter", null);
>>
>> AuthenticationFilter.class is mine, jersey is working fine /
>> answering
>> requests but @RolesAllowed does nothing to restrict its behavior and,
>> in fact, no instance of my AuthenticationFilter ever gets
>> instantiated.
>>
>> Is it OK that my AuthenticationFilter wants to be created by
>> injection? I'm not seeing any guice errors saying it can't do so,
>> and
>> in my ServletModule.configureServlets() I'm binding the
>> AuthenticationProvider class to a specific implementation.
>>
>> Does that sound correct?
>>
>> --C
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>