简体   繁体   English

在 Spring 集成(入站网关)中传递非标准 Header 名称

[英]Passing non-standard Header names in Spring Integration (inbound gateway)

do you know a simple way how to add a non-standard Header name when using spring integration (inbound gateway).您知道在使用 spring 集成(入站网关)时如何添加非标准Header 名称的简单方法吗? It looks like default class DefaultHttpHeaderMapper might be a key element but how can you gain an additional header name to the header. When sending a header with a name that is not included in the Spring Integration standard list of header names it is ignored.它看起来像默认 class DefaultHttpHeaderMapper 可能是一个关键元素,但你怎么能获得额外的 header 名称到 header。当发送 header 时,其名称未包含在 Spring 集成标准列表 88065 中,88185 被忽略。 I want to use an additional one in a simple way.我想以一种简单的方式使用一个额外的。

Thanks a lot非常感谢

The simplest way is to enable all the headers like this on the HttpInboundEndpointSupportSpec , when you use Java DSL for the Http.inboundGateway() :最简单的方法是在HttpInboundEndpointSupportSpec上启用所有标头,当您将 Java DSL 用于Http.inboundGateway()时:

.mappedRequestHeaders("*")

Another way is to use standard headers and a list of your custom:另一种方法是使用标准标题和自定义列表:

.mappedRequestHeaders(DefaultHttpHeaderMapper.HTTP_REQUEST_HEADER_NAME_PATTERN, "my_custom_header1", "my_custom_header2")

See more in docs: https://docs.spring.io/spring-integration/docs/current/reference/html/http.html#http-header-mapping在文档中查看更多信息: https://docs.spring.io/spring-integration/docs/current/reference/html/http.html#http-header-mapping

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM