Top Description Fields Constructors Methods
org.springframework.web.multipart.support

public abstract Class AbstractMultipartHttpServletRequest

extends HttpServletRequestWrapper
implements MultipartHttpServletRequest
Class Inheritance
All Implemented Interfaces
org.springframework.web.multipart.MultipartHttpServletRequest, org.springframework.web.multipart.MultipartRequest, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
Known Direct Subclasses
org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest, org.springframework.web.multipart.support.StandardMultipartHttpServletRequest
Imports
java.util.Collections, .Enumeration, .Iterator, .List, .Map, jakarta.servlet.http.HttpServletRequest, .HttpServletRequestWrapper, org.springframework.http.HttpHeaders, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.LinkedMultiValueMap, .MultiValueMap, org.springframework.web.multipart.MultipartFile, .MultipartHttpServletRequest

Abstract base implementation of the MultipartHttpServletRequest interface.

Provides management of pre-generated MultipartFile instances.

Authors
Juergen Hoeller, Arjen Poutsma
Since
06.10.2003

Field Summary

Modifier and TypeField and Description
private MultiValueMap<String, MultipartFile>

Constructor Summary

AccessConstructor and Description
protected
AbstractMultipartHttpServletRequest(HttpServletRequest
the request to wrap
request
)

Wrap the given HttpServletRequest in a MultipartHttpServletRequest.

Method Summary

Modifier and TypeMethod and Description
public MultipartFile
getFile(String
a String specifying the parameter name of the multipart file
name
)

Implements org.springframework.web.multipart.MultipartRequest.getFile.

Return the contents plus description of an uploaded file in this request, or null if it does not exist.
public Map<String, MultipartFile>
getFileMap()

Implements org.springframework.web.multipart.MultipartRequest.getFileMap.

Return a java.util.Map of the multipart files contained in this request.
public Iterator<String>
getFileNames()

Implements org.springframework.web.multipart.MultipartRequest.getFileNames.

Return an java.util.Iterator of String objects containing the parameter names of the multipart files contained in this request.
public List<MultipartFile>
getFiles(String
a String specifying the parameter name of the multipart file
name
)

Implements org.springframework.web.multipart.MultipartRequest.getFiles.

Return the contents plus description of uploaded files in this request, or an empty list if it does not exist.
public MultiValueMap<String, MultipartFile>
getMultiFileMap()

Implements org.springframework.web.multipart.MultipartRequest.getMultiFileMap.

Return a MultiValueMap of the multipart files contained in this request.
protected MultiValueMap<String, MultipartFile>
getMultipartFiles()

Obtain the MultipartFile Map for retrieval, lazily initializing it if necessary.

public HttpServletRequest
getRequest()

Overrides jakarta.servlet.ServletRequestWrapper.getRequest.

Get the wrapped request.
public HttpHeaders
getRequestHeaders()

Implements org.springframework.web.multipart.MultipartHttpServletRequest.getRequestHeaders.

Return this request's headers as a convenient HttpHeaders instance.
public HttpMethod
getRequestMethod()

Implements org.springframework.web.multipart.MultipartHttpServletRequest.getRequestMethod.

Return this request's method as a convenient HttpMethod instance.
protected void
initializeMultipart()

Lazily initialize the multipart request, if possible.

public boolean

Returns:

true when eagerly initialized or lazily triggered, false in case of a lazy-resolution request that got aborted before any parameters or multipart files have been accessed
isResolved
()

Determine whether the underlying multipart request has been resolved.

protected final void
setMultipartFiles(MultiValueMap<String, MultipartFile> multipartFiles)

Set a Map with parameter names as keys and list of MultipartFile objects as values.

Inherited from jakarta.servlet.http.HttpServletRequestWrapper:
authenticatechangeSessionIdgetAuthTypegetContextPathgetCookiesgetDateHeadergetHeadergetHeaderNamesgetHeadersgetHttpServletMappinggetIntHeadergetMethodgetPartgetPartsgetPathInfogetPathTranslatedgetQueryStringgetRemoteUsergetRequestedSessionIdgetRequestURIgetRequestURLgetServletPathgetSessiongetSessiongetTrailerFieldsgetUserPrincipalisRequestedSessionIdFromCookieisRequestedSessionIdFromURLisRequestedSessionIdValidisTrailerFieldsReadyisUserInRoleloginlogoutnewPushBuilderupgrade

Field Detail

multipartFilesback to summary
private MultiValueMap<String, MultipartFile> multipartFiles
Annotations
@Nullable

Constructor Detail

AbstractMultipartHttpServletRequestback to summary
protected AbstractMultipartHttpServletRequest(HttpServletRequest request)

Wrap the given HttpServletRequest in a MultipartHttpServletRequest.

Parameters
request:HttpServletRequest

the request to wrap

Method Detail

getFileback to summary
public MultipartFile getFile(String name)

Implements org.springframework.web.multipart.MultipartRequest.getFile.

Doc from org.springframework.web.multipart.MultipartRequest.getFile.

Return the contents plus description of an uploaded file in this request, or null if it does not exist.

Parameters
name:String

a String specifying the parameter name of the multipart file

Returns:MultipartFile

the uploaded content in the form of a MultipartFile object

Annotations
@Override
getFileMapback to summary
public Map<String, MultipartFile> getFileMap()

Implements org.springframework.web.multipart.MultipartRequest.getFileMap.

Doc from org.springframework.web.multipart.MultipartRequest.getFileMap.

Return a java.util.Map of the multipart files contained in this request.

Returns:Map<String, MultipartFile>

a map containing the parameter names as keys, and the MultipartFile objects as values

Annotations
@Override
getFileNamesback to summary
public Iterator<String> getFileNames()

Implements org.springframework.web.multipart.MultipartRequest.getFileNames.

Doc from org.springframework.web.multipart.MultipartRequest.getFileNames.

Return an java.util.Iterator of String objects containing the parameter names of the multipart files contained in this request. These are the field names of the form (like with normal parameters), not the original file names.

Returns:Iterator<String>

the names of the files

Annotations
@Override
getFilesback to summary
public List<MultipartFile> getFiles(String name)

Implements org.springframework.web.multipart.MultipartRequest.getFiles.

Doc from org.springframework.web.multipart.MultipartRequest.getFiles.

Return the contents plus description of uploaded files in this request, or an empty list if it does not exist.

Parameters
name:String

a String specifying the parameter name of the multipart file

Returns:List<MultipartFile>

the uploaded content in the form of a MultipartFile list

Annotations
@Override
getMultiFileMapback to summary
public MultiValueMap<String, MultipartFile> getMultiFileMap()

Implements org.springframework.web.multipart.MultipartRequest.getMultiFileMap.

Doc from org.springframework.web.multipart.MultipartRequest.getMultiFileMap.

Return a MultiValueMap of the multipart files contained in this request.

Returns:MultiValueMap<String, MultipartFile>

a map containing the parameter names as keys, and a list of MultipartFile objects as values

Annotations
@Override
getMultipartFilesback to summary
protected MultiValueMap<String, MultipartFile> getMultipartFiles()

Obtain the MultipartFile Map for retrieval, lazily initializing it if necessary.

See Also
initializeMultipart()
getRequestback to summary
public HttpServletRequest getRequest()

Overrides jakarta.servlet.ServletRequestWrapper.getRequest.

Doc from jakarta.servlet.ServletRequestWrapper.getRequest.

Get the wrapped request.

Returns:HttpServletRequest

the wrapped request object

Annotations
@Override
getRequestHeadersback to summary
public HttpHeaders getRequestHeaders()

Implements org.springframework.web.multipart.MultipartHttpServletRequest.getRequestHeaders.

Doc from org.springframework.web.multipart.MultipartHttpServletRequest.getRequestHeaders.

Return this request's headers as a convenient HttpHeaders instance.

Annotations
@Override
getRequestMethodback to summary
public HttpMethod getRequestMethod()

Implements org.springframework.web.multipart.MultipartHttpServletRequest.getRequestMethod.

Doc from org.springframework.web.multipart.MultipartHttpServletRequest.getRequestMethod.

Return this request's method as a convenient HttpMethod instance.

Annotations
@Override
initializeMultipartback to summary
protected void initializeMultipart()

Lazily initialize the multipart request, if possible. Only called if not already eagerly initialized.

isResolvedback to summary
public boolean isResolved()

Determine whether the underlying multipart request has been resolved.

Returns:boolean

true when eagerly initialized or lazily triggered, false in case of a lazy-resolution request that got aborted before any parameters or multipart files have been accessed

Since
4.3.15
See Also
getMultipartFiles()
setMultipartFilesback to summary
protected final void setMultipartFiles(MultiValueMap<String, MultipartFile> multipartFiles)

Set a Map with parameter names as keys and list of MultipartFile objects as values. To be invoked by subclasses on initialization.