-
Bug
-
Resolution: Won't Do
-
Major
-
3.0.6.Final
@GET @Produces({"application/json; profile=\"v1\"", "application/json; profile=\"v2\""}) Response getSomeEntity();
@Singleton @Provider @Produces("application/json; profile=\"v1\"") public class SomeEntityV1MessageBodyWriter implements MessageBodyWriter<SomeEntityPojo> { @Override public void writeTo(SomeEntityPojo someEntity, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { System.out.println("Writing V1"); } // SNIP }
@Singleton @Provider @Produces("application/json; profile=\"v2\"") public class SomeEntityV2MessageBodyWriter implements MessageBodyWriter<SomeEntityPojo> { @Override public void writeTo(SomeEntityPojo someEntity, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { System.out.println("Writing V2"); } // SNIP }
Regardless of which media type is provided in the accept header
application/json; profile="v1"
or
application/json; profile="v2"
only the v1 message body writer seems to get called. It seems to me that the media type parameters are not being taken into consideration when deciding on which message body writer to use.