'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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Artem Bilan