문제

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