The actual error was caused by a missing "charset="

Sergey
On 25/10/16 13:34, Benson Margulies wrote:
Adding a charset to the json mime type is not permitted. Json as a MIME
type must be UTF-8, period, the modifier is not permitted by the relevant
RFC / IANA specs.


On Tue, Oct 25, 2016 at 8:28 AM, Dennis Kieselhorst <m...@dekies.de> wrote:

Hi,

what is the best practice to specify the encoding for a JAX-RS response?

If found something like this: @Produces(MediaType.APPLICATION_JSON + ";"
+ CharEncoding.UTF_8)

However it fails with:

Caused by: java.lang.IllegalArgumentException: Wrong media type
parameter, separator is missing
    at
org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.addParameter(
MediaTypeHeaderProvider.java:121)
    at
org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.internalValueOf(
MediaTypeHeaderProvider.java:108)
    at
org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.valueOf(
MediaTypeHeaderProvider.java:65)
    at
org.apache.cxf.jaxrs.utils.JAXRSUtils.toMediaType(JAXRSUtils.java:1715)
    at
org.apache.cxf.jaxrs.utils.JAXRSUtils.parseMediaTypes(
JAXRSUtils.java:1445)
    at
org.apache.cxf.jaxrs.utils.JAXRSUtils.getMediaTypes(JAXRSUtils.java:233)
    at
org.apache.cxf.jaxrs.model.OperationResourceInfo.checkMediaTypes(
OperationResourceInfo.java:249)
    at
org.apache.cxf.jaxrs.model.OperationResourceInfo.<init>(
OperationResourceInfo.java:89)


Regards

Dennis





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to