简体   繁体   中英

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). 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. 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() :

.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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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