Class DefaultMultipartHttpServletRequest
- java.lang.Object
- javax.servlet.ServletRequestWrapper
- javax.servlet.http.HttpServletRequestWrapper
- org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
- org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest
- All Implemented Interfaces:
HttpServletRequest,ServletRequest,MultipartHttpServletRequest,MultipartRequest
public class DefaultMultipartHttpServletRequest extends AbstractMultipartHttpServletRequest
Default implementation of theMultipartHttpServletRequestinterface. Provides management of pre-generated parameter values.Used by
CommonsMultipartResolver.- Since:
- 29.09.2003
- Author:
- Trevor D. Cook, Juergen Hoeller, Arjen Poutsma
- See Also:
MultipartResolver
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Constructor Summary
Constructors Constructor Description DefaultMultipartHttpServletRequest(HttpServletRequest request)Wrap the given HttpServletRequest in a MultipartHttpServletRequest.DefaultMultipartHttpServletRequest(HttpServletRequest request, MultiValueMap<String,MultipartFile> mpFiles, Map<String,String[]> mpParams, Map<String,String> mpParamContentTypes)Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMultipartContentType(String paramOrFileName)Determine the content type of the specified request part.HttpHeadersgetMultipartHeaders(String paramOrFileName)Return the headers associated with the specified part of the multipart request.protected Map<String,String>getMultipartParameterContentTypes()Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.protected Map<String,String[]>getMultipartParameters()Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.StringgetParameter(String name)The default behavior of this method is to return getParameter(String name) on the wrapped request object.Map<String,String[]>getParameterMap()The default behavior of this method is to return getParameterMap() on the wrapped request object.Enumeration<String>getParameterNames()The default behavior of this method is to return getParameterNames() on the wrapped request object.String[]getParameterValues(String name)The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.protected voidsetMultipartParameterContentTypes(Map<String,String> multipartParameterContentTypes)Set a Map with parameter names as keys and content type Strings as values.protected voidsetMultipartParameters(Map<String,String[]> multipartParameters)Set a Map with parameter names as keys and String array objects as values.Methods inherited from class org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
getFile, getFileMap, getFileNames, getFiles, getMultiFileMap, getMultipartFiles, getRequest, getRequestHeaders, getRequestMethod, initializeMultipart, isResolved, setMultipartFiles
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.servlet.http.HttpServletRequest
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
Constructor Detail
DefaultMultipartHttpServletRequest
public DefaultMultipartHttpServletRequest(HttpServletRequest request, MultiValueMap<String,MultipartFile> mpFiles, Map<String,String[]> mpParams, Map<String,String> mpParamContentTypes)
Wrap the given HttpServletRequest in a MultipartHttpServletRequest.- Parameters:
request- the servlet request to wrapmpFiles- a map of the multipart filesmpParams- a map of the parameters to expose, with Strings as keys and String arrays as values
DefaultMultipartHttpServletRequest
public DefaultMultipartHttpServletRequest(HttpServletRequest request)
Wrap the given HttpServletRequest in a MultipartHttpServletRequest.- Parameters:
request- the servlet request to wrap
Method Detail
getParameter
@Nullable public String getParameter(String name)
Description copied from class:javax.servlet.ServletRequestWrapperThe default behavior of this method is to return getParameter(String name) on the wrapped request object.- Specified by:
getParameterin interfaceServletRequest- Overrides:
getParameterin classServletRequestWrapper- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting the single value of the parameter - See Also:
ServletRequest.getParameterValues(java.lang.String)
getParameterValues
public String[] getParameterValues(String name)
Description copied from class:javax.servlet.ServletRequestWrapperThe default behavior of this method is to return getParameterValues(String name) on the wrapped request object.- Specified by:
getParameterValuesin interfaceServletRequest- Overrides:
getParameterValuesin classServletRequestWrapper- Parameters:
name- aStringcontaining the name of the parameter whose value is requested- Returns:
- an array of
Stringobjects containing the parameter's values - See Also:
ServletRequest.getParameter(java.lang.String)
getParameterNames
public Enumeration<String> getParameterNames()
Description copied from class:javax.servlet.ServletRequestWrapperThe default behavior of this method is to return getParameterNames() on the wrapped request object.- Specified by:
getParameterNamesin interfaceServletRequest- Overrides:
getParameterNamesin classServletRequestWrapper- Returns:
- an
EnumerationofStringobjects, eachStringcontaining the name of a request parameter; or an emptyEnumerationif the request has no parameters
getParameterMap
public Map<String,String[]> getParameterMap()
Description copied from class:javax.servlet.ServletRequestWrapperThe default behavior of this method is to return getParameterMap() on the wrapped request object.- Specified by:
getParameterMapin interfaceServletRequest- Overrides:
getParameterMapin classServletRequestWrapper- Returns:
- an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
getMultipartContentType
public String getMultipartContentType(String paramOrFileName)
Description copied from interface:MultipartRequestDetermine the content type of the specified request part.- Parameters:
paramOrFileName- the name of the part- Returns:
- the associated content type, or
nullif not defined
getMultipartHeaders
public HttpHeaders getMultipartHeaders(String paramOrFileName)
Description copied from interface:MultipartHttpServletRequestReturn the headers associated with the specified part of the multipart request.If the underlying implementation supports access to headers, then all headers are returned. Otherwise, the returned headers will include a 'Content-Type' header at the very least.
setMultipartParameters
protected final void setMultipartParameters(Map<String,String[]> multipartParameters)
Set a Map with parameter names as keys and String array objects as values. To be invoked by subclasses on initialization.
getMultipartParameters
protected Map<String,String[]> getMultipartParameters()
Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.
setMultipartParameterContentTypes
protected final void setMultipartParameterContentTypes(Map<String,String> multipartParameterContentTypes)
Set a Map with parameter names as keys and content type Strings as values. To be invoked by subclasses on initialization.
getMultipartParameterContentTypes
protected Map<String,String> getMultipartParameterContentTypes()
Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.