Spring Integration Http Outbound Gateway Header Mapper

我正在尝试将自定义标头添加到我的http出站网关。

我尝试和工作的事情:

       

在上面的场景中,它可以工作,但我添加的自定义标头默认以X-为前缀。

为了摆脱它,我尝试了以下但它没有将自定义值设置为标题:

             

花了很多时间试图解决这个问题后,我陷入了困境。 任何帮助,将不胜感激。

我刚刚使用示例应用程序测试了您的映射器,它工作得很好……

            POST /http/receiveGateway HTTP/1.1 Accept: text/plain, */* Operation: foo StatusCode: bar Content-Type: text/plain;charset=UTF-8 Accept-Charset: big5, ... User-Agent: Java/1.8.0_60 Host: localhost:8080 Connection: keep-alive Content-Length: 5 

打开org.springframework.integration DEBUG日志记录以获取标头映射的详细日志记录…

 11:13:19.562 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] headerName=[operation] WILL be mapped, matched pattern=operation 11:13:19.562 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] setting headerName=[Operation], value=foo 11:13:19.563 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] headerName=[errorchannel] WILL NOT be mapped 11:13:19.563 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] headerName=[id] WILL NOT be mapped 11:13:19.563 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] headerName=[statuscode] WILL be mapped, matched pattern=statuscode 11:13:19.563 DEBUG [main][org.springframework.integration.http.support.DefaultHttpHeaderMapper] setting headerName=[StatusCode], value=bar