]
Radoslav Rábara closed JBIDE-18078.
-----------------------------------
Verified with JBDS 8.0.0.CR1-v20140831-0335-B201
Wrong problem marker on binding annotation
------------------------------------------
Key: JBIDE-18078
URL:
https://issues.jboss.org/browse/JBIDE-18078
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: webservices
Affects Versions: 4.2.0.Beta3
Reporter: Xavier Coulon
Assignee: Xavier Coulon
Fix For: 4.2.0.CR1
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:
{code}
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(value = RetentionPolicy.RUNTIME)
@NameBinding
public @interface CacheControlBinding { }
{code}
and
{code}
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(value = RetentionPolicy.RUNTIME)
@NameBinding
public @interface RequestIfNoneMatchBinding {
}
{code}
on
{code}
@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();
}
}
{code}
with
{code}
@Provider
@CacheControlBinding
public class CacheControlNoCacheDirectiveFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext
responseContext)
throws IOException {
responseContext.getHeaders().add("Cache-Control", "no-cache");
}
}
{code}
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.