users@jersey.java.net

[Jersey] security filter does not get called if more than one filter is configured on the servlet adapter

From: Arul Dhesiaseelan <aruld_at_acm.org>
Date: Fri, 3 Jun 2011 12:56:16 -0600

Hi,

I created an instance of Grizzly server as shown:

    ServletHandler jerseyAdapter = new ServletHandler();

jerseyAdapter.addInitParameter("com.sun.jersey.config.property.packages",
"resources");
    jerseyAdapter.setContextPath("/master");
    jerseyAdapter.setServletInstance(new ServletContainer());

jerseyAdapter.addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
SecurityFilter.class.getName());

jerseyAdapter.addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
LoggingFilter.class.getName());

jerseyAdapter.addInitParameter(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS,
LoggingFilter.class.getName());
    HttpServer webServer =
GrizzlyServerFactory.createHttpServer(getBaseURI(), jerseyAdapter);

If I configure the security filter as the first one as shown in the above
code, it never gets called. If I move the security filter to the last spot,
then it gets called. Is there a known problem with the ordering of filters?

I am using Jersey 1.7.

-Arul