[jbosstools-issues] [JBoss JIRA] (JBIDE-18078) Wrong problem marker on binding annotation
Xavier Coulon (JIRA)
issues at jboss.org
Mon Aug 18 06:01:41 EDT 2014
[ https://issues.jboss.org/browse/JBIDE-18078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xavier Coulon updated JBIDE-18078:
----------------------------------
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:
{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.
was:
Have a project where there are 2 custom NameBinding annotations, one of them being associated with a 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).
> 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.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jbosstools-issues
mailing list