Question

I have a Spring and Jersey application and has that line:

return Response.ok().header("Content-Type", "application/xml; charset=UTF-8").entity(restTemplate.postForObject(baseURL, entity, String.class)).build();

However when I debug at server side I see that Content-Type header is just application/xml. Any ideas?

Était-ce utile?

La solution

However when I debug at server side I see that Content-Type header is just application/xml

I am getting this in my code and during debug I can see the header which is proper.

Please verify.

I don't know but Sorry if I went wrong.

enter image description here

Autres conseils

You have to set a separate header with

.header("charset", "UTF-8")

Seems like Jersey is reading the header value only upto the semicolon.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top