users@jersey.java.net

Re: [Jersey] Re: _at_RolesAllowed

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Wed, 9 Jun 2010 11:20:16 -0400

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