hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

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

Open redrezo opened 7 years ago

redrezo commented 7 years ago

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