Book Image

Mastering Spring Application Development

By : Anjana Mankale
Book Image

Mastering Spring Application Development

By: Anjana Mankale

Overview of this book

Table of Contents (19 chapters)
Mastering Spring Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring the outbound HTTP messages


Spring provides HttpRequestExecutingMessageHandler, which takes a string URL as a constructor argument. The class has a property called ReponseChannel, which also needs to be configured.

The bean will call the RestTemplate class by reading the URL configured in the constructor, which the RestTemplate calls HttpMessageConverters. The list of HttpMessageConverters are read and the HttpRequest body is generated.

The converter and HttpRequestExecutingMessageHandler are shown in the following code:

<bean id="httpOutbound" class="org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler">
  <constructor-arg value="http://localhost:8080/myweb" />
  <property name="outputChannel" ref="responseChannel" />
</bean>

OR

<bean id="httpOutbound" class="org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler">
  <constructor-arg value="http://localhost:8080/myweb" />
  <property name...