osgi-jax-rs-connector icon indicating copy to clipboard operation
osgi-jax-rs-connector copied to clipboard

ConsumerFactory does not respect @Consumes and @Produces annotations on interface

Open redrezo opened this issue 8 years ago • 0 comments

While it is possible to set the default behavior for all service methods by specifing @Consumes and @Produces on the interface itself (which is working just fine with the publisher), the ConsumerFactory seems to only look for those annotations on the method itself.

This interface works fine on the publisher, but not with the consumer (it tries to lookup a provider for plain/text)

@Path("/test")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public interface TestService {
  @PUT
  @Path("/doIt")
  Model doIt(Model model);
}

while this version also works with the consumer

@Path("/test")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public interface TestService {
  @PUT
  @Path("/doIt")
  @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
  @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
  Model doIt(Model model);
}

edit: observed in version 5.3.1

redrezo avatar Dec 28 '16 14:12 redrezo