org.springframework.integration.http
Class DefaultInboundRequestMapper
java.lang.Object
org.springframework.integration.http.DefaultInboundRequestMapper
- All Implemented Interfaces:
- InboundRequestMapper, InboundMessageMapper<javax.servlet.http.HttpServletRequest>
public class DefaultInboundRequestMapper
- extends java.lang.Object
- implements InboundRequestMapper
Default implementation of InboundRequestMapper
for inbound HttpServletRequests.
The request will be mapped according to the following rules:
- For a GET request or a POST request with a Content-Type of
"application/x-www-form-urlencoded", the parameter Map will be copied as the
payload. The map's keys will be Strings, and the values will be String arrays
as described for
ServletRequest.getParameterMap()
.
- If a MultipartResolver has been provided, and a multipart request is
detected, the multipart file content will be converted to String for any
"text" content type, or byte arrays otherwise.
- For other request types, the request body will be used as the payload
and the type will depend on the Content-Type header value. If it begins with
"text", a String will be created. If the Content-Type is
"application/x-java-serialized-object", the request body will be expected to
contain a Serializable Object, and that will be used as the message payload.
Otherwise, the payload will be a byte array.
In all cases, the original request headers will be passed in the
MessageHeaders. Likewise, the following headers will be added:
- Since:
- 1.0.2
- Author:
- Mark Fisher
Method Summary |
void |
setMultipartCharset(java.lang.String multipartCharset)
Specify the charset name to use when converting multipart file content
into Strings. |
void |
setMultipartResolver(org.springframework.web.multipart.MultipartResolver multipartResolver)
Specify the MultipartResolver to use when checking requests. |
Message<?> |
toMessage(javax.servlet.http.HttpServletRequest request)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultInboundRequestMapper
public DefaultInboundRequestMapper()
setMultipartResolver
public void setMultipartResolver(org.springframework.web.multipart.MultipartResolver multipartResolver)
- Specify the
MultipartResolver
to use when checking requests.
If no resolver is provided, this mapper will not support multipart
requests.
setMultipartCharset
public void setMultipartCharset(java.lang.String multipartCharset)
- Specify the charset name to use when converting multipart file content
into Strings.
toMessage
public Message<?> toMessage(javax.servlet.http.HttpServletRequest request)
throws java.lang.Exception
- Specified by:
toMessage
in interface InboundMessageMapper<javax.servlet.http.HttpServletRequest>
- Throws:
java.lang.Exception