I use the filter ContainerRequestFilter
as follows:
@NameBinding
@Target({TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface SomeFilterAnn {}
@SomeFilterAnn
@Provider
public class SomeFilter implements ContainerRequestFilter {
private static final Logger LOG = LoggerFactory.getLogger(SomeFilter.class);
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
}
}
This allows you to automatically bind the filter to recreation resources @SomeFilterAnn
. This also works for sub-resources, unlike DynamicFeature
described here .
I need, however, to do some advanced configuration for mine SomeFilter
and wonder what is the jax-rs way to do this, i.e. use @Context
/ @Provider
or some CXF or WildFly 8.2 mechanism (but not RESTEasy and Jersey) or another way to provide access to the configuration logic.
source
share