Mapping URI variables as subelement with an HTTP outbound gateway and an outbound channel adapter

In this section, we shall see the use of a URI variable, and URI variable expressions, as a subelement with the HTTP outbound gateway configuration.

If your URL contains URI variables, you can map them using the Uri-variable subelement. This subelement is available for the HTTP outbound gateway and the HTTP outbound channel adapter:

<int-http:outbound-gateway id="trafficGateway"
    url="http://local.yahooapis.com/trafficData?appid=YdnDemo&amp;zip={zipCode}"
    request-channel="trafficChannel"
    http-method="GET"
    expected-response-type="java.lang.String">
    <int-http:uri-variable name="zipCode" expression="payload.getZip()"/>
</int-http:outbound-gateway>

The

Get Mastering Spring Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.