public class DefaultHttpHeaderMapper extends Object implements HeaderMapper<HttpHeaders>, BeanFactoryAware, InitializingBean
HeaderMapper
implementation for HTTP.Constructor and Description |
---|
DefaultHttpHeaderMapper() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected boolean |
containsElementIgnoreCase(String[] headerNames,
String name) |
protected String |
convertToString(Object value) |
protected String |
formatDate(long date) |
void |
fromHeaders(MessageHeaders headers,
HttpHeaders target)
Map from the integration MessageHeaders to an HttpHeaders instance.
|
protected BeanFactory |
getBeanFactory() |
protected long |
getFirstDate(String headerValue,
String headerName) |
protected Object |
getHttpHeader(HttpHeaders source,
String name) |
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(BeanFactory beanFactory) |
void |
setExcludedInboundStandardResponseHeaderNames(String[] excludedInboundStandardResponseHeaderNames)
Provide header names from the list of standard headers that should be suppressed when
mapping inbound endpoint response headers.
|
void |
setExcludedOutboundStandardRequestHeaderNames(String[] excludedOutboundStandardRequestHeaderNames)
Provide header names from the list of standard headers that should be suppressed when
mapping outbound endpoint request headers.
|
void |
setInboundHeaderNames(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(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.
|
protected static void |
setupDefaultInboundMapper(DefaultHttpHeaderMapper mapper)
Subclasses can call this from a static inboundMapper() method to set up
standard header mappings for an inbound mapper.
|
protected static void |
setupDefaultOutboundMapper(DefaultHttpHeaderMapper mapper)
Subclasses can call this from a static outboundMapper() method to set up
standard header mappings for an outbound mapper.
|
void |
setUserDefinedHeaderPrefix(String userDefinedHeaderPrefix)
Sets the prefix to use with user-defined (non-standard) headers.
|
protected boolean |
shouldMapInboundHeader(String headerName) |
Map<String,Object> |
toHeaders(HttpHeaders source)
Map from an HttpHeaders instance to integration MessageHeaders.
|
protected final Log logger
public static final String ACCEPT
public static final String ACCEPT_CHARSET
public static final String ACCEPT_ENCODING
public static final String ACCEPT_LANGUAGE
public static final String ACCEPT_RANGES
public static final String AGE
public static final String ALLOW
public static final String AUTHORIZATION
public static final String CACHE_CONTROL
public static final String CONNECTION
public static final String CONTENT_ENCODING
public static final String CONTENT_LANGUAGE
public static final String CONTENT_LENGTH
public static final String CONTENT_LOCATION
public static final String CONTENT_MD5
public static final String CONTENT_RANGE
public static final String CONTENT_TYPE
public static final String CONTENT_DISPOSITION
public static final String COOKIE
public static final String DATE
public static final String ETAG
public static final String EXPECT
public static final String EXPIRES
public static final String FROM
public static final String HOST
public static final String IF_MATCH
public static final String IF_MODIFIED_SINCE
public static final String IF_NONE_MATCH
public static final String IF_RANGE
public static final String IF_UNMODIFIED_SINCE
public static final String LAST_MODIFIED
public static final String LOCATION
public static final String MAX_FORWARDS
public static final String PRAGMA
public static final String PROXY_AUTHENTICATE
public static final String PROXY_AUTHORIZATION
public static final String RANGE
public static final String REFERER
public static final String REFRESH
public static final String RETRY_AFTER
public static final String SERVER
public static final String SET_COOKIE
public static final String TE
public static final String TRAILER
public static final String UPGRADE
public static final String USER_AGENT
public static final String VARY
public static final String VIA
public static final String WARNING
public static final String WWW_AUTHENTICATE
public static final String TRANSFER_ENCODING
public static final String HTTP_REQUEST_HEADER_NAME_PATTERN
public static final String HTTP_RESPONSE_HEADER_NAME_PATTERN
protected static final String[] DATE_FORMATS
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected BeanFactory getBeanFactory()
public void setOutboundHeaderNames(String[] outboundHeaderNames)
Any non-standard headers will be prefixed with the value specified by
setUserDefinedHeaderPrefix(String)
. The default is 'X-'.
outboundHeaderNames
- The outbound header names.public void setInboundHeaderNames(String[] inboundHeaderNames)
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-'.
inboundHeaderNames
- The inbound header names.public void setExcludedOutboundStandardRequestHeaderNames(String[] excludedOutboundStandardRequestHeaderNames)
excludedOutboundStandardRequestHeaderNames
- the excludedStandardRequestHeaderNames to setpublic void setExcludedInboundStandardResponseHeaderNames(String[] excludedInboundStandardResponseHeaderNames)
excludedInboundStandardResponseHeaderNames
- the excludedStandardResponseHeaderNames to setpublic void setUserDefinedHeaderPrefix(String userDefinedHeaderPrefix)
userDefinedHeaderPrefix
- The user defined header prefix.public void fromHeaders(MessageHeaders headers, HttpHeaders target)
fromHeaders
in interface HeaderMapper<HttpHeaders>
public Map<String,Object> toHeaders(HttpHeaders source)
toHeaders
in interface HeaderMapper<HttpHeaders>
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected final boolean containsElementIgnoreCase(String[] headerNames, String name)
protected final boolean shouldMapInboundHeader(String headerName)
protected Object getHttpHeader(HttpHeaders source, String name)
protected String formatDate(long date)
public static DefaultHttpHeaderMapper outboundMapper()
protected static void setupDefaultOutboundMapper(DefaultHttpHeaderMapper mapper)
mapper
- the mapper.public static DefaultHttpHeaderMapper inboundMapper()
protected static void setupDefaultInboundMapper(DefaultHttpHeaderMapper mapper)
mapper
- the mapper.