November 2017
Intermediate to advanced
420 pages
10h 29m
English
It is perfectly legal to have multiple filters or interceptors added for a REST client or server. In such a case, you might want to control the order in which they are executed at runtime. JAX-RS allows you to manage the order of execution by adding the @javax.annotation.Priority annotation on the filter or the interceptor class. The Priority values should be non-negative. You can use standard constants defined in the javax.ws.rs.Priorities class to set the priorities. An example is given here:
@Provider
@Priority(Priorities.HEADER_DECORATOR)
public class JAXRSReaderInterceptor implements ReaderInterceptor {
//Interceptor implementation goes here
}
Interceptors and filters are ...