4

We are using java ee interceptors on JAX-RS web services.

We intercept using this annotation:

@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 "";
}

The interceptor is declared like so:

@Interceptor
@FunctionalityAuthorization
public class FunctionalityAuthorizationInterceptor {

@AroundInvoke
public Object intercept(InvocationContext context) throws Exception {

We then have annotations on the REST methods:

@GET
@Produces("application/json")
@FunctionalityAuthorization(Functionalities.TMSALERTS_ALERTS_VIEW)
public AlertDto[] get() {

We also of course specify the interceptor in the beans.xml file.

The interceptors check that the user does have the right to access the REST service which is being called.

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.

Any idea what could explain the difference in behaviour? This is Glassfish 3.1.2.2.

4
  • This questions seems to be very specific to your code base and what versions got deployed in different environments. Doesn't look like a generic question, that can be answered. Aug 5, 2014 at 12:05
  • I don't know, there is one version of Glassfish, 3.1.2.2, always the same. The WAR is the same. The java version is the same (we even removed the difference Oracle java vs OpenJDK). I think it's more a Glassfish bug, but who knows for sure... Aug 5, 2014 at 12:08
  • You still face this issue, after 7 months ? Just to know, so I can help Aug 5, 2014 at 12:08
  • No, we retired the machine (it's still alive though). I'm still curious as to what could cause it.. I'm hoping someone would get the same problem and answer the question after finding out the reason... I have done things like that in the past. But I probably should simply delete the question now. Aug 5, 2014 at 12:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.