Class StandardMultipartHttpServletRequest

java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
org.springframework.web.multipart.support.StandardMultipartHttpServletRequest
All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest, MultipartHttpServletRequest, MultipartRequest

public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpServletRequest
Spring MultipartHttpServletRequest adapter, wrapping a Servlet HttpServletRequest and its Part objects. Parameters get exposed through the native request's getParameter methods - without any custom processing on our side.
Since:
3.1
Author:
Juergen Hoeller, Rossen Stoyanchev
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
    StandardMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request)
    Create a new StandardMultipartHttpServletRequest wrapper for the given request, immediately parsing the multipart content.
    StandardMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request, boolean lazyParsing)
    Create a new StandardMultipartHttpServletRequest wrapper for the given request.
  • 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 void
     
    protected void
    Lazily initialize the multipart request, if possible.

    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, getParameter, getParameterValues, 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, getParameter, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setCharacterEncoding, startAsync, startAsync
  • Constructor Details

    • StandardMultipartHttpServletRequest

      public StandardMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request) throws MultipartException
      Create a new StandardMultipartHttpServletRequest wrapper for the given request, immediately parsing the multipart content.
      Parameters:
      request - the servlet request to wrap
      Throws:
      MultipartException - if parsing failed
    • StandardMultipartHttpServletRequest

      public StandardMultipartHttpServletRequest(jakarta.servlet.http.HttpServletRequest request, boolean lazyParsing) throws MultipartException
      Create a new StandardMultipartHttpServletRequest wrapper for the given request.
      Parameters:
      request - the servlet request to wrap
      lazyParsing - whether multipart parsing should be triggered lazily on first access of multipart files or parameters
      Throws:
      MultipartException - if an immediate parsing attempt failed
      Since:
      3.2.9
  • Method Details

    • handleParseFailure

      protected void handleParseFailure(Throwable ex)
    • initializeMultipart

      protected void initializeMultipart()
      Description copied from class: AbstractMultipartHttpServletRequest
      Lazily initialize the multipart request, if possible. Only called if not already eagerly initialized.
      Overrides:
      initializeMultipart in class AbstractMultipartHttpServletRequest
    • 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.