Spring Framework

org.springframework.web.multipart.support
Class DefaultMultipartHttpServletRequest

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
              extended by org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, MultipartHttpServletRequest, MultipartRequest

public class DefaultMultipartHttpServletRequest
extends AbstractMultipartHttpServletRequest

Default implementation of the MultipartHttpServletRequest interface. Provides management of pre-generated parameter values.

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
DefaultMultipartHttpServletRequest(javax.servlet.http.HttpServletRequest request)
          Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
DefaultMultipartHttpServletRequest(javax.servlet.http.HttpServletRequest request, MultiValueMap<java.lang.String,MultipartFile> mpFiles, java.util.Map<java.lang.String,java.lang.String[]> mpParams, java.util.Map<java.lang.String,java.lang.String> mpParamContentTypes)
          Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
 
Method Summary
 java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
          Determine the content type of the specified request part.
 HttpHeaders getMultipartHeaders(java.lang.String paramOrFileName)
          Return the headers associated with the specified part of the multipart request.
protected  java.util.Map<java.lang.String,java.lang.String> getMultipartParameterContentTypes()
          Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.
protected  java.util.Map<java.lang.String,java.lang.String[]> getMultipartParameters()
          Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
protected  void setMultipartParameterContentTypes(java.util.Map<java.lang.String,java.lang.String> multipartParameterContentTypes)
          Set a Map with parameter names as keys and content type Strings as values.
protected  void setMultipartParameters(java.util.Map<java.lang.String,java.lang.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, setMultipartFiles
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, 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, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout
 
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, 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(javax.servlet.http.HttpServletRequest request,
                                          MultiValueMap<java.lang.String,MultipartFile> mpFiles,
                                          java.util.Map<java.lang.String,java.lang.String[]> mpParams,
                                          java.util.Map<java.lang.String,java.lang.String> mpParamContentTypes)
Wrap the given HttpServletRequest in a MultipartHttpServletRequest.

Parameters:
request - the servlet request to wrap
mpFiles - a map of the multipart files
mpParams - a map of the parameters to expose, with Strings as keys and String arrays as values

DefaultMultipartHttpServletRequest

public DefaultMultipartHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Wrap the given HttpServletRequest in a MultipartHttpServletRequest.

Parameters:
request - the servlet request to wrap
Method Detail

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper

getMultipartContentType

public java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
Description copied from interface: MultipartRequest
Determine the content type of the specified request part.

Parameters:
paramOrFileName - the name of the part
Returns:
the associated content type, or null if not defined

getMultipartHeaders

public HttpHeaders getMultipartHeaders(java.lang.String paramOrFileName)
Description copied from interface: MultipartHttpServletRequest
Return 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(java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.String[]> getMultipartParameters()
Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.

See Also:
AbstractMultipartHttpServletRequest.initializeMultipart()

setMultipartParameterContentTypes

protected final void setMultipartParameterContentTypes(java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.String> getMultipartParameterContentTypes()
Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.

See Also:
AbstractMultipartHttpServletRequest.initializeMultipart()

Spring Framework