Announcement Announcement Module
Collapse
No announcement yet.
Forwarding Request Parameters from Inbound Gateway to Outbound Gateway Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forwarding Request Parameters from Inbound Gateway to Outbound Gateway

    Hi,

    I am using Spring 3.0.6 and Integration 2.1.0 M3.

    I am forwarding one request from Inbound Gateway to outbound gateway. I want to forward query string (request parameters) with this request. Following is my implementation.

    I am calling my inbound gateway with

    http://localhost:8080/RestSampleProj...121?abc=454545

    I am able to access value 12121 as a path variable, but I am not able to forward value of variable "abc" to the business componenet (outbound gateway)

    Please help.

    Code:
    	<int-http:inbound-gateway id="findLogsInboundGateway" payload-expression="#requestParams"
    					request-channel="getLogsByVendorInChannel"
    					reply-channel="getLogsByVendorOutChannel"
    					name="/fetchAllLogs/{vendor}"
    					path="/fetchAllLogs/{vendor}"                          
    					supported-methods="GET">
    		<int-http:header name="vendor" expression="#pathVariables.vendor"/>
    		<int-http:header name="params" expression="#requestParams"/>
    	</int-http:inbound-gateway>
                              
        <int-http:outbound-gateway id="findLogsoutboundGateway"
                               url="http://localhost:8080/BusinessSampleProject/fetchAllLogs/{vendor}"
                               http-method="GET" mapped-request-headers="params" 
                               request-channel="getLogsByVendorInChannel"
                               reply-channel="getLogsByVendorOutChannel"
                               expected-response-type="java.lang.String"
                               charset="UTF-8" 
                               >
    		<int-http:uri-variable name="vendor" expression="headers.vendor"/>
        </int-http:outbound-gateway>

  • #2
    The 'mapped-request-headers' attribute is actually for setting values of HTTP headers on the request (not query params). If you want to pass the query params as-is, then you could use the {placeholder} syntax in the URL, but then you would need to set its value to the query *string* (not the the same as #requestParams which contains a map). For that, you could use the header whose key is HttpHeaders.REQUEST_URL, or you could rely on the fact that the default request payload for a GET on an inbound-gateway is the request param Map itself.

    Hope that helps.
    -Mark

    Comment

    Working...
    X