Content-Type on http:inbound-gateway response has

2019-08-06 12:44发布

问题:

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>