Content-Type on http:inbound-gateway response has charset=iso-8859-1 instead of utf-8

给你一囗甜甜゛ 提交于 2019-12-24 13:55:04

问题


I want to build a ws proxy so I use an http:inbound-gateway. It worked fine but I'm having some trouble with the encoding. All responses have Content-Type: text/plain; charset=iso-8859-1 instead of Content-Type: text/xml; charset=utf-8, so when the response has special characters, they are not sent correctly

please, could you tell me how to config this?

here's my flow:

<int-http:inbound-gateway request-channel="channel"
    path="/services/router" supported-methods="POST"
    reply-channel="channel" >
    <int-http:request-mapping consumes="text/xml"
        produces="text/xml" />
</int-http:inbound-gateway>

<int:channel id="channel">
    <int:interceptors>
        <int:wire-tap channel="logger" />
    </int:interceptors>
</int:channel>

<int:logging-channel-adapter log-full-message="true" id="logger"/>

thanks in advance

regards

Guzman


回答1:


Is that what you're receiving from the proxied server?

You can always change the outgoing content type by adding a header enricher to the reply flow...

    <int:header-enricher>
        <int:header name="Content-Type" value="text/xml;charset=utf-8" override="true"/>
    </int:header-enricher>


来源:https://stackoverflow.com/questions/32400813/content-type-on-httpinbound-gateway-response-has-charset-iso-8859-1-instead-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!