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?

有帮助吗?

解决方案

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

其他提示

You have to set a separate header with

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top