-
Bug
-
Resolution: Done
-
Major
-
3.0.19.Final
-
None
I have a JAX-RS application declaring an empty Application subclass with only a couple of annotations: @ApplicationPath and @Monitored (self-defined name binding annotation).
@ApplicationPath("/xxx") @Monitored // My custom JAX-RS name binding annotation public class ServiceApplication extends Application {}
For reference, this is the definition of the @Monitored annotation:
@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) @NameBinding public @interface Monitored {}
I am also applying the @Monitored annotation to a JAX-RS request/response filter:
@Provider @Monitored public class MonitoringFilter implements ContainerRequestFilter, ContainerResponseFilter { /** The application context, used for retrieving the {@link ApplicationPath} value. */ @Context Application application; // [...] }
Per the JAX-RS spec this should cause my filter to intercept all requests to resources belonging to ServiceApplication (which, since I'm not doing anything else, defaults to all resources defined in the webapp.
If I run my application under WildFly without Weld, everything runs just fine. My filter intercepts all requests and its application field points to an instance of ServiceApplication. As soon as I activate Weld a couple of things happen:
- My filter stops working. I can make it work again by applying the @Monitored annotation to each and every resource class, and then I see:
- The application field of the filter gets set to a Weld proxy of ServiceApplication and this proxy is missing both the @ApplicationPath and @Monitored annotations. The requests still get routed properly (e.g. if my resource is annotated with @Path("/yyy") then I have to use /xxx/yyy to get to it) but I cannot reconstruct that path by looking at the annotations of the application and the resource.