I am running Jersey in a non-servlet container (Netty). For servlet-based containers, I can plug in a request filter using :
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
But how do I do this programmatically in my case ?
Here is a completely non-servlet example: Assuming you have created your request and/or response filter(s), you can add them to your startup code as follows: (Please note ApiInterceptor class is both a request and a response filter in this example)
Not sure about Netty, but for Grizzly its: