Announcement Announcement Module
Collapse
No announcement yet.
http-outbound-gateway: Adding header to the httpRequest and avoid propagation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • http-outbound-gateway: Adding header to the httpRequest and avoid propagation

    Hi!

    I've a chain which performs a call to a http-outbound-gateway. The httpRequest should include a specific header, so I use a header enricher to add it:

    Code:
    <int:chain input-channel="requestChannel" output-channel="responseChannel">       
    <int:header-enricher> <int:header name="customHeader" value="myCustomHeaderValue" /> </int:header-enricher> <int-http:outbound-gateway url="http://myurl/rest" http-method="GET" expected-response-type="MyResponseType" mapped-request-headers="HTTP_REQUEST_HEADERS, customHeader" mapped-response-headers="avoidParseExpireHeader(EQ)One"/>
    </int:chain>
    Is there any way to avoid the propagation of the custom header through the rest of channels after the chain???? or should I add a request header filter in the last step of the chain????

    In order to add httpRequest headers and avoid its propagation would be great if the http-outbound-gateway will be able to do something like this:

    Code:
    <int-http:outbound-gateway
                    url="http://myurl/rest"
                    http-method="GET"
                    expected-response-type="MyResponseType"
                    mapped-request-headers="HTTP_REQUEST_HEADERS"
                    mapped-response-headers="avoidParseExpireHeader(EQ)One">   
    
    <int-http:header name="customHeader" value="myCustomHeaderValue"/>
    </int-http:outbound-gateway>

  • #2
    You can add a <header-filter/> right after the gateway (at the end of the chain).

    Comment


    • #3
      Or, use a custom header mapper in the gateway; but the filter is probably the simplest technique.

      Comment


      • #4
        Yes, I knew the header filter stuff.... but when I've several gateways and a set of headers for each one, the config gets ugly, adding and removing headers everywhere. So I wondered if it was possible to avoid it, something like the "<int-http:header>".

        Thanks!

        Comment

        Working...
        X