org.springframework.integration.http.support
Class DefaultHttpHeaderMapper

java.lang.Object
  extended by org.springframework.integration.http.support.DefaultHttpHeaderMapper
All Implemented Interfaces:
HeaderMapper<HttpHeaders>

public class DefaultHttpHeaderMapper
extends java.lang.Object
implements HeaderMapper<HttpHeaders>

Default HeaderMapper implementation for HTTP.

Since:
2.0

Field Summary
static java.lang.String HTTP_REQUEST_HEADER_NAME_PATTERN
           
static java.lang.String HTTP_RESPONSE_HEADER_NAME_PATTERN
           
 
Constructor Summary
DefaultHttpHeaderMapper()
           
 
Method Summary
 void fromHeaders(MessageHeaders headers, 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 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,?> toHeaders(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

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

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-'.


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,
                        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<HttpHeaders>

toHeaders

public java.util.Map<java.lang.String,?> toHeaders(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<HttpHeaders>

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.