22.3 Http Outbound Gateway

To configure the HttpOutboundEndpoint write a bean definition like this:

<bean id="httpOutbound" class="org.springframework.integration.http.HttpOutboundEndpoint" >
	<property name="outputChannel" ref="responseChannel" />
</bean>

This bean definition will execute Http requests by first converting the message to the Http request using an instance of DefaultOutboundRequestMapper. This will expect to find the request URL in the message header under the key HttpHeaders.REQUEST_URL. It is also possible to set a default target URL as a constructor argument along with other options as shown below.

<bean id="httpOutbound" class="org.springframework.integration.http.HttpOutboundEndpoint" >
	<constructor-arg value="http://localhost:8080/example" />
	<property name="outputChannel" ref="responseChannel" />
	<property name="sendTimeout" value="5000" />
	<property name="requestMapper" ref="customRequestMapper" />
</bean>

By default the Http request will be made using an instance of SimpleHttpRequestExecutor which uses the JDK HttpURLConnection. Use of the Apache Commons Http Client is also supported through the provided CommonsHttpRequestExecutor which can be injected into the outbound gateway.