Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-18090

Wrong JAX-RS Filter/Annotation binding problem report

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.2.0.CR1
    • 4.2.0.Beta3
    • webservices
    • None

    Description

      The JAX-RS validator reports a false problem on Interceptors and Filters with binding annotations, when multiple binding anntotations on the target Resource or Resource Methods are involved.

      Eg:

      @Target({ ElementType.TYPE, ElementType.METHOD })
      @Retention(value = RetentionPolicy.RUNTIME)
      @NameBinding
      public @interface RequestIfNoneMatchBinding { }
      

      and

      @Target({ ElementType.TYPE, ElementType.METHOD })
      @Retention(value = RetentionPolicy.RUNTIME)
      @NameBinding
      public @interface CacheInvalidationBinding {}
      

      with

      @Provider
      @PreMatching
      @RequestIfNoneMatchBinding
      public class RequestIfNoneMatchFilter implements ContainerRequestFilter {
      
      	@Override
      	public void filter(final ContainerRequestContext requestContext) throws IOException {
      		...
      	}
      }
      

      on

      @RequestScoped
      @Path("/foo")
      public class RestResource {
      
              @GET
              @RequestIfNoneMatchBinding
      	@CacheControlBinding
      	public Response getAll() {
      		return Response.ok().build();
      	}
      }
      

      The RequestIfNoneMatchFilter class will have a JAX-RS problem reported while it should not be the case.

      The spec mentions that the resource/resource method should be annotated with all the same binding annotations as the Filter/Interceptor, which is the case here. Nothing prevents a resource / resource method to be bound to multiple Filter or Interceptor

      Attachments

        Issue Links

          Activity

            People

              xcoulon@redhat.com Xavier Coulon
              xcoulon@redhat.com Xavier Coulon
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: