users@jersey.java.net

Re: [Jersey] Re: _at_RolesAllowed

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Jun 2010 17:54:43 +0200

Hi Christopher,

W.r.t. Guice configuration you need to add the init params in the
serve method.

I cannot explain why the TAF class gets instantiated, is bound using
Guice?

IIRC Grizzly will initiate the servlet on the first request to that
servlet.

Paul.


On Jun 9, 2010, at 5:20 PM, Christopher Piggott wrote:

> Relating to my problem with my ContainerRequestFilter (for
> authentication):
>
> private method WebApplicationImpl._handleRequest() is getting called
> but there's only one filter listed, an instance of
> com.sun.jersey.server.impl.container.filter.NormalizeFilter ... my TAF
> (see below) isn't in the list for some reason.
>
>
>
> On Wed, Jun 9, 2010 at 10:40 AM, Christopher Piggott <cpiggott_at_gmail.com
> > wrote:
>> Here's an example of something I'm having a lot of trouble figuring
>> out how to debug.
>>
>> ServletAdapter sa = new ServletAdapter();
>> sa.addInitParameter(PackagesResourceConfig.PROPERTY_PACKAGES,
>> "my.package.resources");
>> sa.setContextPath("/");
>> sa.setServletInstance(new ServletContainer());
>>
>> //
>> // Add the authetication filter
>> //
>>
>> sa
>> .addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
>> TAF.class.getName());
>>
>> TAF is a very simple filter that I wrote just to test
>>
>> public class TAF implements ContainerRequestFilter {
>> public TAF()
>> {
>> super();
>> System.err.println("!!!!!!!! FILTER CREATED");
>> }
>> @Override
>> public ContainerRequest filter(ContainerRequest request) {
>> System.err.println("!!!!!!!!!!!! FILTER INVOKED");
>> return request;
>> }
>> }
>>
>> I can see it telling me the filter got created (interestingly, this
>> happens at the first request, rather than immediately upon the server
>> starting).... but my filter is never getting invoked.
>>
>> Tracing through the source of grizzly-servlet-webserver and
>> grizzly-http-servlet is ... challenging. I would love a log.debug()
>> telling me "Filter not invoked, it hast he wrong XYZ" or something
>> like that.
>>
>> What do you recommend as a debugging approach?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>