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

Spring support for header customizations


If we need to do further customization to the header, then the Spring Integration package provides us with complete support. If we explicitly specify the header names in the configuration with comma separated values, the default behavior will be overridden.

The following is the configuration for further header customization:

<int-http:outbound-gateway id="httpGateway"
    url="http://localhost/app2"
    mapped-request-headers="boo, bar"
    mapped-response-headers="X-*, HTTP_RESPONSE_HEADERS"
    channel="someChannel"/>

<int-http:outbound-channel-adapter id="httpAdapter"
    url="http://localhost/app2"
    mapped-request-headers="boo, bar, HTTP_REQUEST_HEADERS"
    channel="someChannel"/>

Another option is to use the header-mapper attribute, which takes the DefaultHttpHeaderMapper class configurations.

The class comes with factory methods that are static for inbound and outbound adapters.

The following is the configuration for the header-mapper...