Spring Integration

org.springframework.integration.http.support
Class DefaultHttpHeaderMapper

java.lang.Object
  extended by org.springframework.integration.http.support.DefaultHttpHeaderMapper
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, HeaderMapper<org.springframework.http.HttpHeaders>

public class DefaultHttpHeaderMapper
extends java.lang.Object
implements HeaderMapper<org.springframework.http.HttpHeaders>, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

Default HeaderMapper implementation for HTTP.

Since:
2.0
Author:
Mark Fisher, Jeremy Grelle, Oleg Zhurakousky, Gunnar Hillert, Gary Russell, Artem Bilan

Field Summary
static java.lang.String COOKIE
           
static java.lang.String HTTP_REQUEST_HEADER_NAME_PATTERN
           
static java.lang.String HTTP_RESPONSE_HEADER_NAME_PATTERN
           
static java.lang.String SET_COOKIE
           
 
Constructor Summary
DefaultHttpHeaderMapper()
           
 
Method Summary
 void afterPropertiesSet()
           
 void fromHeaders(MessageHeaders headers, org.springframework.http.HttpHeaders target)
          Map from the integration MessageHeaders to an HttpHeaders instance.
static DefaultHttpHeaderMapper inboundMapper()
          Factory method for creating a basic inbound mapper instance.
static DefaultHttpHeaderMapper outboundMapper()
          Factory method for creating a basic outbound mapper instance.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setExcludedInboundStandardResponseHeaderNames(java.lang.String[] excludedInboundStandardResponseHeaderNames)
          Provide header names from the list of standard headers that should be suppressed when mapping inbound endopoint response headers.
 void setExcludedOutboundStandardRequestHeaderNames(java.lang.String[] excludedOutboundStandardRequestHeaderNames)
          Provide header names from the list of standard headers that should be suppressed when mapping outbound endpoint request headers.
 void setInboundHeaderNames(java.lang.String[] inboundHeaderNames)
          Provide the header names that should be mapped from an HTTP request (for inbound adapters) or HTTP response (for outbound adapters) to a Spring Integration Message's headers.
 void setOutboundHeaderNames(java.lang.String[] outboundHeaderNames)
          Provide the header names that should be mapped to an HTTP request (for outbound adapters) or HTTP response (for inbound adapters) from a Spring Integration Message's headers.
 void setUserDefinedHeaderPrefix(java.lang.String userDefinedHeaderPrefix)
          Sets the prefix to use with user-defined (non-standard) headers.
 java.util.Map<java.lang.String,java.lang.Object> toHeaders(org.springframework.http.HttpHeaders source)
          Map from an HttpHeaders instance to integration MessageHeaders.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COOKIE

public static final java.lang.String COOKIE
See Also:
Constant Field Values

SET_COOKIE

public static final java.lang.String SET_COOKIE
See Also:
Constant Field Values

HTTP_REQUEST_HEADER_NAME_PATTERN

public static final java.lang.String HTTP_REQUEST_HEADER_NAME_PATTERN
See Also:
Constant Field Values

HTTP_RESPONSE_HEADER_NAME_PATTERN

public static final java.lang.String HTTP_RESPONSE_HEADER_NAME_PATTERN
See Also:
Constant Field Values
Constructor Detail

DefaultHttpHeaderMapper

public DefaultHttpHeaderMapper()
Method Detail

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException

setOutboundHeaderNames

public void setOutboundHeaderNames(java.lang.String[] outboundHeaderNames)
Provide the header names that should be mapped to an HTTP request (for outbound adapters) or HTTP response (for inbound adapters) from a Spring Integration Message's headers. The values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched.

Any non-standard headers will be prefixed with the value specified by setUserDefinedHeaderPrefix(String). The default is 'X-'.


setInboundHeaderNames

public void setInboundHeaderNames(java.lang.String[] inboundHeaderNames)
Provide the header names that should be mapped from an HTTP request (for inbound adapters) or HTTP response (for outbound adapters) to a Spring Integration Message's headers. The values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched.

This will match the header name directly or, for non-standard HTTP headers, it will match the header name prefixed with the value specified by setUserDefinedHeaderPrefix(String). The default is 'X-'.


setExcludedOutboundStandardRequestHeaderNames

public void setExcludedOutboundStandardRequestHeaderNames(java.lang.String[] excludedOutboundStandardRequestHeaderNames)
Provide header names from the list of standard headers that should be suppressed when mapping outbound endpoint request headers.

Parameters:
excludedOutboundStandardRequestHeaderNames - the excludedStandardRequestHeaderNames to set

setExcludedInboundStandardResponseHeaderNames

public void setExcludedInboundStandardResponseHeaderNames(java.lang.String[] excludedInboundStandardResponseHeaderNames)
Provide header names from the list of standard headers that should be suppressed when mapping inbound endopoint response headers.

Parameters:
excludedInboundStandardResponseHeaderNames - the excludedStandardResponseHeaderNames to set

setUserDefinedHeaderPrefix

public void setUserDefinedHeaderPrefix(java.lang.String userDefinedHeaderPrefix)
Sets the prefix to use with user-defined (non-standard) headers. Default is 'X-'.


fromHeaders

public void fromHeaders(MessageHeaders headers,
                        org.springframework.http.HttpHeaders target)
Map from the integration MessageHeaders to an HttpHeaders instance. Depending on which type of adapter is using this mapper, the HttpHeaders might be for an HTTP request (outbound adapter) or for an HTTP response (inbound adapter).

Specified by:
fromHeaders in interface HeaderMapper<org.springframework.http.HttpHeaders>

toHeaders

public java.util.Map<java.lang.String,java.lang.Object> toHeaders(org.springframework.http.HttpHeaders source)
Map from an HttpHeaders instance to integration MessageHeaders. Depending on which type of adapter is using this mapper, the HttpHeaders might be from an HTTP request (inbound adapter) or from an HTTP response (outbound adapter).

Specified by:
toHeaders in interface HeaderMapper<org.springframework.http.HttpHeaders>

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

outboundMapper

public static DefaultHttpHeaderMapper outboundMapper()
Factory method for creating a basic outbound mapper instance. This will map all standard HTTP request headers when sending an HTTP request, and it will map all standard HTTP response headers when receiving an HTTP response.


inboundMapper

public static DefaultHttpHeaderMapper inboundMapper()
Factory method for creating a basic inbound mapper instance. This will map all standard HTTP request headers when receiving an HTTP request, and it will map all standard HTTP response headers when sending an HTTP response.


Spring Integration