We use java ee interceptors on JAX-RS web services.
We intercept this annotation:
@InterceptorBinding
@Inherited
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface FunctionalityAuthorization {
@Nonbinding public String value() default "";
}
The interceptor is declared like this:
@Interceptor
@FunctionalityAuthorization
public class FunctionalityAuthorizationInterceptor {
@AroundInvoke
public Object intercept(InvocationContext context) throws Exception {
Then we have annotations for REST methods:
@GET
@Produces("application/json")
@FunctionalityAuthorization(Functionalities.TMSALERTS_ALERTS_VIEW)
public AlertDto[] get() {
We also, of course, specify an interceptor in the file beans.xml.
Interceptors check to see if the user has access to the REST service that is being called.
: , ! , ( , , , , Glassfish , WAR , ...), .
, ? Glassfish 3.1.2.2.