Note that there are some explanatory texts on larger screens.

plurals
  1. POinterceptors invoked on developers' machine not on server
    text
    copied!<p>We are using java ee interceptors on JAX-RS web services.</p> <p>We intercept using this annotation:</p> <pre><code>@InterceptorBinding @Inherited @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface FunctionalityAuthorization { //using non binding to allow interception of all calls with the annotation //not only if the value matches @Nonbinding public String value() default ""; } </code></pre> <p>The interceptor is declared like so:</p> <pre><code>@Interceptor @FunctionalityAuthorization public class FunctionalityAuthorizationInterceptor { @AroundInvoke public Object intercept(InvocationContext context) throws Exception { </code></pre> <p>We then have annotations on the REST methods:</p> <pre><code>@GET @Produces("application/json") @FunctionalityAuthorization(Functionalities.TMSALERTS_ALERTS_VIEW) public AlertDto[] get() { </code></pre> <p>We also of course specify the interceptor in the <code>beans.xml</code> file.</p> <p>The interceptors check that the user does have the right to access the REST service which is being called.</p> <p>Now we have a shocking situation: we realised the interceptors are not working on our staging server! But they work on our developer machines, and despite our attempts to configure the developer machines as close as possible to the staging server (same set of other applications installed, all the settings we could find, backup of the same database, standalone Glassfish installation of the same version, same WAR file than on the server...), we cannot reproduce the problem on developer machines.</p> <p>Any idea what could explain the difference in behaviour? This is Glassfish 3.1.2.2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload