users@jersey.java.net

programmatically config jersey filter

From: Yoryos <valotas_at_gmail.com>
Date: Mon, 2 Aug 2010 22:26:58 +0300

Hi all,
is there a way to pragmatically config jersey filter? As I've seen on the
docs overriding the ServletContainer#initiate method should do the trick but
as I've seen I can not put there any king of properties. I've overridden it
to something like that:

@Override
protected void initiate(ResourceConfig rc, WebApplication wa) {
rc.getProperties().put(DefaultResourceConfig.FEATURE_REDIRECT, "true");
String[] filters = new String[]
{ResourceDebuggingFilterFactory.class.getName()};
rc.getProperties().put(DefaultResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES,
filters);
System.out.println(rc.getProperties());
super.initiate(rc, wa);
}

From the method above, the filter factories seems to work just fine but the
redirect future not. If I comment out the redirect feature and put it as a
filter's init-param it will work just fine. In both cases I see all the
properties defined just fine (from the System.out.println)