【问题标题】:http-outbound-gateway sets wrong content-type headerhttp-outbound-gateway 设置错误的内容类型标头
【发布时间】:2014-08-28 20:24:21
【问题描述】:

我们从 SIv3.x 迁移到 SIv4.0.4,发现现在 http-outbound-gateway 错误地设置了 content-type 标头。不是将其设置为这种内容类型,而是将其设置为 contentType。环顾四周,我发现这可能是因为现在 SI 使用 Spring Messaging 类,其中该属性被命名为 contentType。

public static final String CONTENT_TYPE = "contentType";

有没有办法在 http-outbound 中或在使用 object-to-json-transformer 之前正确设置此内容类型?

提前致谢 问候 古兹曼

【问题讨论】:

    标签: spring-integration


    【解决方案1】:

    嗯,我理解你的意思,这确实是一个错误,我们在迁移到 Spring Messaging 时错过了它。

    请就此事提出JIRA 票 - 我们必须将contentType 消息头映射到Content-Type HTTP 头。

    现在作为一种解决方法,您可以手动re-map

    <header-enricher>
       <header name="#{T(org.springframework.http.HttpHeaders).CONTENT_TYPE}" expression="headers[#{T(org.springframework.messaging.MessageHeaders).CONTENT_TYPE}]"/>
    </header-enricher>
    

    不是在&lt;obeject-to-json-transformer&gt; 之前,而是在&lt;int-http:outbound-gateway&gt; 之后和之前

    【讨论】:

    猜你喜欢
    • 2019-02-24
    • 1970-01-01
    • 2016-04-17
    • 2012-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    相关资源
    最近更新 更多