public class DefaultHttpHeaderMapper extends Object implements HeaderMapper<HttpHeaders>, BeanFactoryAware, InitializingBean
HeaderMapper implementation for HTTP.| Modifier and Type | Field and Description |
|---|---|
static String |
ACCEPT
Deprecated.
since 5.2 in favor of
HttpHeaders.ACCEPT |
static String |
ACCEPT_CHARSET
Deprecated.
since 5.2 in favor of
HttpHeaders.ACCEPT_CHARSET |
static String |
ACCEPT_ENCODING
Deprecated.
since 5.2 in favor of
HttpHeaders.ACCEPT_ENCODING |
static String |
ACCEPT_LANGUAGE
Deprecated.
since 5.2 in favor of
HttpHeaders.ACCEPT_LANGUAGE |
static String |
ACCEPT_RANGES
Deprecated.
since 5.2 in favor of
HttpHeaders.ACCEPT_RANGES |
static String |
AGE
Deprecated.
since 5.2 in favor of
HttpHeaders.AGE |
static String |
ALLOW
Deprecated.
since 5.2 in favor of
HttpHeaders.ALLOW |
static String |
AUTHORIZATION
Deprecated.
since 5.2 in favor of
HttpHeaders.AUTHORIZATION |
static String |
CACHE_CONTROL
Deprecated.
since 5.2 in favor of
HttpHeaders.CACHE_CONTROL |
static String |
CONNECTION
Deprecated.
since 5.2 in favor of
HttpHeaders.CONNECTION |
static String |
CONTENT_DISPOSITION
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_DISPOSITION |
static String |
CONTENT_ENCODING
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_ENCODING |
static String |
CONTENT_LANGUAGE
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_LANGUAGE |
static String |
CONTENT_LENGTH
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_LENGTH |
static String |
CONTENT_LOCATION
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_LOCATION |
static String |
CONTENT_MD5 |
static String |
CONTENT_RANGE
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_RANGE |
static String |
CONTENT_TYPE
Deprecated.
since 5.2 in favor of
HttpHeaders.CONTENT_TYPE |
static String |
COOKIE
Deprecated.
since 5.2 in favor of
HttpHeaders.COOKIE |
static String |
DATE
Deprecated.
since 5.2 in favor of
HttpHeaders.DATE |
protected static java.time.format.DateTimeFormatter[] |
DATE_FORMATS |
static String |
ETAG
Deprecated.
since 5.2 in favor of
HttpHeaders.ETAG |
static String |
EXPECT
Deprecated.
since 5.2 in favor of
HttpHeaders.EXPECT |
static String |
EXPIRES
Deprecated.
since 5.2 in favor of
HttpHeaders.EXPIRES |
static String |
FROM
Deprecated.
since 5.2 in favor of
HttpHeaders.FROM |
static String |
HOST
Deprecated.
since 5.2 in favor of
HttpHeaders.HOST |
static String |
HTTP_REQUEST_HEADER_NAME_PATTERN |
static String |
HTTP_RESPONSE_HEADER_NAME_PATTERN |
static String |
IF_MATCH
Deprecated.
since 5.2 in favor of
HttpHeaders.IF_MATCH |
static String |
IF_MODIFIED_SINCE
Deprecated.
since 5.2 in favor of
HttpHeaders.IF_MODIFIED_SINCE |
static String |
IF_NONE_MATCH
Deprecated.
since 5.2 in favor of
HttpHeaders.IF_NONE_MATCH |
static String |
IF_RANGE
Deprecated.
since 5.2 in favor of
HttpHeaders.IF_RANGE |
static String |
IF_UNMODIFIED_SINCE
Deprecated.
since 5.2 in favor of
HttpHeaders.IF_UNMODIFIED_SINCE |
static String |
LAST_MODIFIED
Deprecated.
since 5.2 in favor of
HttpHeaders.LAST_MODIFIED |
static String |
LOCATION
Deprecated.
since 5.2 in favor of
HttpHeaders.LOCATION |
protected Log |
logger |
static String |
MAX_FORWARDS
Deprecated.
since 5.2 in favor of
HttpHeaders.MAX_FORWARDS |
static String |
PRAGMA
Deprecated.
since 5.2 in favor of
HttpHeaders.PRAGMA |
static String |
PROXY_AUTHENTICATE
Deprecated.
since 5.2 in favor of
HttpHeaders.PROXY_AUTHENTICATE |
static String |
PROXY_AUTHORIZATION
Deprecated.
since 5.2 in favor of
HttpHeaders.PROXY_AUTHORIZATION |
static String |
RANGE
Deprecated.
since 5.2 in favor of
HttpHeaders.RANGE |
static String |
REFERER
Deprecated.
since 5.2 in favor of
HttpHeaders.REFERER |
static String |
REFRESH |
static String |
RETRY_AFTER
Deprecated.
since 5.2 in favor of
HttpHeaders.RETRY_AFTER |
static String |
SERVER
Deprecated.
since 5.2 in favor of
HttpHeaders.SERVER |
static String |
SET_COOKIE
Deprecated.
since 5.2 in favor of
HttpHeaders.SET_COOKIE |
static String |
TE
Deprecated.
since 5.2 in favor of
HttpHeaders.TE |
static String |
TRAILER
Deprecated.
since 5.2 in favor of
HttpHeaders.TRAILER |
static String |
TRANSFER_ENCODING
Deprecated.
since 5.2 in favor of
HttpHeaders.TRANSFER_ENCODING |
static String |
UPGRADE
Deprecated.
since 5.2 in favor of
HttpHeaders.UPGRADE |
static String |
USER_AGENT
Deprecated.
since 5.2 in favor of
HttpHeaders.USER_AGENT |
static String |
VARY
Deprecated.
since 5.2 in favor of
HttpHeaders.VARY |
static String |
VIA
Deprecated.
since 5.2 in favor of
HttpHeaders.VIA |
static String |
WARNING
Deprecated.
since 5.2 in favor of
HttpHeaders.WARNING |
static String |
WWW_AUTHENTICATE
Deprecated.
since 5.2 in favor of
HttpHeaders.WWW_AUTHENTICATE |
| Constructor and Description |
|---|
DefaultHttpHeaderMapper() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected static boolean |
containsElementIgnoreCase(String[] headerNames,
String name) |
protected String |
convertToString(Object value) |
void |
fromHeaders(MessageHeaders headers,
HttpHeaders target)
Map from the integration MessageHeaders to an HttpHeaders instance.
|
protected BeanFactory |
getBeanFactory() |
protected static 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... inboundHeaderNamesArg)
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
@Deprecated public static final String ACCEPT
HttpHeaders.ACCEPT@Deprecated public static final String ACCEPT_CHARSET
HttpHeaders.ACCEPT_CHARSET@Deprecated public static final String ACCEPT_ENCODING
HttpHeaders.ACCEPT_ENCODING@Deprecated public static final String ACCEPT_LANGUAGE
HttpHeaders.ACCEPT_LANGUAGE@Deprecated public static final String ACCEPT_RANGES
HttpHeaders.ACCEPT_RANGES@Deprecated public static final String AGE
HttpHeaders.AGE@Deprecated public static final String ALLOW
HttpHeaders.ALLOW@Deprecated public static final String AUTHORIZATION
HttpHeaders.AUTHORIZATION@Deprecated public static final String CACHE_CONTROL
HttpHeaders.CACHE_CONTROL@Deprecated public static final String CONNECTION
HttpHeaders.CONNECTION@Deprecated public static final String CONTENT_ENCODING
HttpHeaders.CONTENT_ENCODING@Deprecated public static final String CONTENT_LANGUAGE
HttpHeaders.CONTENT_LANGUAGE@Deprecated public static final String CONTENT_LENGTH
HttpHeaders.CONTENT_LENGTH@Deprecated public static final String CONTENT_LOCATION
HttpHeaders.CONTENT_LOCATION@Deprecated public static final String CONTENT_RANGE
HttpHeaders.CONTENT_RANGE@Deprecated public static final String CONTENT_TYPE
HttpHeaders.CONTENT_TYPE@Deprecated public static final String CONTENT_DISPOSITION
HttpHeaders.CONTENT_DISPOSITION@Deprecated public static final String COOKIE
HttpHeaders.COOKIE@Deprecated public static final String DATE
HttpHeaders.DATE@Deprecated public static final String ETAG
HttpHeaders.ETAG@Deprecated public static final String EXPECT
HttpHeaders.EXPECT@Deprecated public static final String EXPIRES
HttpHeaders.EXPIRES@Deprecated public static final String FROM
HttpHeaders.FROM@Deprecated public static final String HOST
HttpHeaders.HOST@Deprecated public static final String IF_MATCH
HttpHeaders.IF_MATCH@Deprecated public static final String IF_MODIFIED_SINCE
HttpHeaders.IF_MODIFIED_SINCE@Deprecated public static final String IF_NONE_MATCH
HttpHeaders.IF_NONE_MATCH@Deprecated public static final String IF_RANGE
HttpHeaders.IF_RANGE@Deprecated public static final String IF_UNMODIFIED_SINCE
HttpHeaders.IF_UNMODIFIED_SINCE@Deprecated public static final String LAST_MODIFIED
HttpHeaders.LAST_MODIFIED@Deprecated public static final String LOCATION
HttpHeaders.LOCATION@Deprecated public static final String MAX_FORWARDS
HttpHeaders.MAX_FORWARDS@Deprecated public static final String PRAGMA
HttpHeaders.PRAGMA@Deprecated public static final String PROXY_AUTHENTICATE
HttpHeaders.PROXY_AUTHENTICATE@Deprecated public static final String PROXY_AUTHORIZATION
HttpHeaders.PROXY_AUTHORIZATION@Deprecated public static final String RANGE
HttpHeaders.RANGE@Deprecated public static final String REFERER
HttpHeaders.REFERER@Deprecated public static final String RETRY_AFTER
HttpHeaders.RETRY_AFTER@Deprecated public static final String SERVER
HttpHeaders.SERVER@Deprecated public static final String SET_COOKIE
HttpHeaders.SET_COOKIE@Deprecated public static final String TE
HttpHeaders.TE@Deprecated public static final String TRAILER
HttpHeaders.TRAILER@Deprecated public static final String UPGRADE
HttpHeaders.UPGRADE@Deprecated public static final String USER_AGENT
HttpHeaders.USER_AGENT@Deprecated public static final String VARY
HttpHeaders.VARY@Deprecated public static final String VIA
HttpHeaders.VIA@Deprecated public static final String WARNING
HttpHeaders.WARNING@Deprecated public static final String WWW_AUTHENTICATE
HttpHeaders.WWW_AUTHENTICATE@Deprecated public static final String TRANSFER_ENCODING
HttpHeaders.TRANSFER_ENCODINGpublic static final String CONTENT_MD5
public static final String REFRESH
public static final String HTTP_REQUEST_HEADER_NAME_PATTERN
public static final String HTTP_RESPONSE_HEADER_NAME_PATTERN
protected static final java.time.format.DateTimeFormatter[] DATE_FORMATS
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory in interface BeanFactoryAwareBeansExceptionprotected 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... inboundHeaderNamesArg)
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 for
that is an empty String.
inboundHeaderNamesArg - 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 afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic void fromHeaders(MessageHeaders headers, HttpHeaders target)
fromHeaders in interface HeaderMapper<HttpHeaders>public Map<String,Object> toHeaders(HttpHeaders source)
toHeaders in interface HeaderMapper<HttpHeaders>protected Object getHttpHeader(HttpHeaders source, String name)
protected final boolean shouldMapInboundHeader(String headerName)
protected static boolean containsElementIgnoreCase(String[] headerNames, String name)
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.