I am writing a REST client using Jersey with JacksonFeature enabled for a web service that forces me to specify my content type under names, even if it's just plain JSON. In other words, when I do this:
Request request = buildMySampleRequestPojo(); Response response = requestBuilder.post( Entity.entity(request, MediaType.APPLICATION_JSON) );
The service complains that I am using an invalid content type. I can get around this by specifying my media type with the username instead of the MediaType.APPLICATION_JSON constant:
Response response = requestBuilder.post( Entity.entity(request, "vnd.stupidNameThatReallyIsJustJSON+json") );
However, when I do this, I get:
*SEVERE: MessageBodyWriter not found for media type=stupidNameThatReallyIsJustJSON*
Is there a way to get Jersey to treat this customized media type as if it were regular JSON without writing a customized MessageBodyWriter?
java json web-services jersey jersey-client
kwikness
source share