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

Wrong JAX-RS Filter/Annotation binding problem report

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.2.0.Beta3
    • Fix Version/s: 4.2.0.CR1
    • Component/s: webservices
    • Labels:
      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  xcoulon Xavier Coulon
                  Reporter:
                  xcoulon Xavier Coulon
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: