Spring-WS : specifying the Content-Type

前端 未结 1 392
名媛妹妹
名媛妹妹 2021-01-23 11:32

I have a Spring Webservice based on AbstractJDomPayloadEndpoint. This service works fine, except that my client needs the HTTP header Content-Type to b

相关标签:
1条回答
  • 2021-01-23 11:52

    Yes, your filter code will fail because by the time doFilter() completes, the response will have been fully committed, and you won't be allowed to change the content type header.

    I suggest writing a subclass of HttpServletResponseWrapper, overriding the setContentType() and/or setCharacterEncoding() methods to set the value to the one you want. You then pass the instance of the wrapper (which wraps the original response) to the doFilter().

    0 讨论(0)
提交回复
热议问题