Details
-
Bug
-
Resolution: Done
-
Major
-
4.2.0.Beta3
-
None
Description
Have a project where there are 2 custom NameBinding annotations, one of them being associated with a Filter or Interceptor, the other not associated with any Filter or Interceptor.
Put both annotations on a Resource Method, the problem marker (reporting that there is not Filter or Interceptor) may appear on the wrong annotation (ie, the one that is associated with an existing Filter or Interceptor).
For example:
@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) @NameBinding public @interface CacheControlBinding { }
and
@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) @NameBinding public @interface RequestIfNoneMatchBinding { }
on
@RequestScoped @Path("/attendees") @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public class AttendeesResource { @GET @CacheControlBinding @RequestIfNoneMatchBinding public Response getAllAttendees() { final List<AttendeeRepresentation> attendees = attendeeService.getAllAttendees().stream() .map(a -> AttendeeRepresentation.from(a)).collect(Collectors.toList()); return Response.ok(attendees).build(); } }
with
@Provider @CacheControlBinding public class CacheControlNoCacheDirectiveFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { responseContext.getHeaders().add("Cache-Control", "no-cache"); } }
In this case, the JAX-RS validator reports a problem on the @CacheControlBindong annotation on the AttendeesResource#getAllAttendees() method, while the problem should be located on the @RequestIfNoneMatchBinding annotation instead.
Attachments
Issue Links
- is related to
-
JBIDE-18090 Wrong JAX-RS Filter/Annotation binding problem report
- Closed