Class DefaultMultipartHttpServletRequest

java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest
All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest, jakarta.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:
  • Field Summary

    Fields inherited from interface jakarta.servlet.http.HttpServletRequest

    BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request)
    Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
    DefaultMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request, MultiValueMap<String, MultipartFile> mpFiles, Map<String,String[]> mpParams, Map<String,String> mpParamContentTypes)
    Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
  • Method Summary

    Modifier and Type
    Method
    Description
    Determine the content type of the specified request part.
    getMultipartHeaders(String paramOrFileName)
    Return the headers for the specified part of the multipart request.
    protected Map<String,String>
    Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.
    protected Map<String,String[]>
    Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.
     
     
     
     
    protected final void
    setMultipartParameterContentTypes(Map<String,String> multipartParameterContentTypes)
    Set a Map with parameter names as keys and content type Strings as values.
    protected final void
    setMultipartParameters(Map<String,String[]> multipartParameters)
    Set a Map with parameter names as keys and String array objects as values.

    Methods inherited from class jakarta.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, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade

    Methods inherited from class jakarta.servlet.ServletRequestWrapper

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setCharacterEncoding, setRequest, startAsync, startAsync

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.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, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade

    Methods inherited from interface jakarta.servlet.ServletRequest

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setCharacterEncoding, startAsync, startAsync
  • Constructor Details

    • DefaultMultipartHttpServletRequest

      public DefaultMultipartHttpServletRequest(jakarta.servlet.http.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 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(jakarta.servlet.http.HttpServletRequest request)
      Wrap the given HttpServletRequest in a MultipartHttpServletRequest.
      Parameters:
      request - the servlet request to wrap
  • Method Details

    • getParameter

      public @Nullable String getParameter(String name)
      Specified by:
      getParameter in interface jakarta.servlet.ServletRequest
      Overrides:
      getParameter in class jakarta.servlet.ServletRequestWrapper
    • getParameterValues

      public String[] getParameterValues(String name)
      Specified by:
      getParameterValues in interface jakarta.servlet.ServletRequest
      Overrides:
      getParameterValues in class jakarta.servlet.ServletRequestWrapper
    • getParameterNames

      public Enumeration<String> getParameterNames()
      Specified by:
      getParameterNames in interface jakarta.servlet.ServletRequest
      Overrides:
      getParameterNames in class jakarta.servlet.ServletRequestWrapper
    • getParameterMap

      public Map<String,String[]> getParameterMap()
      Specified by:
      getParameterMap in interface jakarta.servlet.ServletRequest
      Overrides:
      getParameterMap in class jakarta.servlet.ServletRequestWrapper
    • getMultipartContentType

      public @Nullable String getMultipartContentType(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 @Nullable HttpHeaders getMultipartHeaders(String paramOrFileName)
      Description copied from interface: MultipartHttpServletRequest
      Return the headers for the specified part of the multipart request.

      If the underlying implementation supports access to part headers, then all headers are returned. Otherwise, for example, for a file upload, the returned headers may expose a 'Content-Type' if available.

    • 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.
      See Also:
    • 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.
      See Also: