2014-08-28 113 views
3

我们从SIv3.x迁移到了SIv4.0.4,发现现在http-outbound-gateway错误地设置了内容类型标题。而不是像这种内容类型设置它,它将它设置为contentType。在我周围搜索发现,这可能是因为现在SI使用Spring Messaging Classes,其中此属性被命名为contentType。http-outbound-gateway设置错误的内容类型标题

public static final String CONTENT_TYPE =“contentType”;

有没有一种方法可以正确地在http-outbound中设置这种内容类型,或者在使用object-to-json-transformer之前?

在此先感谢 问候 古兹曼

回答

2

嗯,我明白你的意思,它是一个真正的错误,我们错过了当迁移到春消息。

请提出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> 

而且不<obeject-to-json-transformer>前,但经过和之前<int-http:outbound-gateway>

+0

感谢的解决方法阿尔乔姆!我添加到JIRA https://jira.spring.io/browse/INT3508。 – gllambi 2014-08-29 21:14:55