public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest
Modifier and Type | Class and Description |
---|---|
static class |
JakartaStreamMultiPartRequest.FileInfo
Internal data structure used to store a reference to information needed
to later pass post processing data to the
FileUploadInterceptor . |
Modifier and Type | Field and Description |
---|---|
protected Map<String,List<JakartaStreamMultiPartRequest.FileInfo>> |
fileInfos
Map between file fields and file data.
|
protected Map<String,List<String>> |
parameters
Map between non-file fields and values.
|
BUFFER_SIZE, bufferSize, defaultEncoding, defaultLocale, errors, maxSize, maxSizeProvided
Constructor and Description |
---|
JakartaStreamMultiPartRequest() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFileSkippedError(String fileName,
javax.servlet.http.HttpServletRequest request)
Add a file skipped message notification for action messages.
|
void |
cleanUp()
Cleans up all uploaded file, should be called at the end of request
|
protected void |
createFileInfoFromItemStream(org.apache.commons.fileupload.FileItemStream itemStream,
File file)
Creates an internal
FileInfo structure used to pass information
to the FileUploadInterceptor during the interceptor stack
invocation process. |
protected File |
createTemporaryFile(String fileName,
String location)
Creates a temporary file based on the given filename and location.
|
String[] |
getContentType(String fieldName)
Returns the content type(s) of the file(s) associated with the specified field name
(as supplied by the client browser), or null if no files are associated with the
given field name.
|
UploadedFile[] |
getFile(String fieldName)
Returns a
UploadedFile object for the filename specified or null if no files
are associated with the given field name. |
String[] |
getFileNames(String fieldName)
Returns a String[] of file names for files associated with the specified input field name
|
Enumeration<String> |
getFileParameterNames()
Returns an enumeration of the parameter names for uploaded files
|
String[] |
getFilesystemName(String fieldName)
Returns the file system name(s) of files associated with the given field name or
null if no files are associated with the given field name.
|
String |
getParameter(String name)
Returns the specified request parameter.
|
Enumeration<String> |
getParameterNames()
Returns an enumeration of String parameter names.
|
String[] |
getParameterValues(String name)
Returns a list of all parameter values associated with a parameter name.
|
protected long |
getRequestSize(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isRequestSizePermitted(javax.servlet.http.HttpServletRequest request)
Defines whether the request allowed based on content length.
|
void |
parse(javax.servlet.http.HttpServletRequest request,
String saveDir) |
protected void |
processFileItemStreamAsFileField(org.apache.commons.fileupload.FileItemStream itemStream,
String location)
Processes the FileItemStream as a file field.
|
protected void |
processFileItemStreamAsFormField(org.apache.commons.fileupload.FileItemStream itemStream)
Processes the FileItemStream as a Form Field.
|
protected void |
processUpload(javax.servlet.http.HttpServletRequest request,
String saveDir)
Processes the upload.
|
protected boolean |
streamFileToDisk(org.apache.commons.fileupload.FileItemStream itemStream,
File file)
Streams the file upload stream to the specified file.
|
buildErrorMessage, getCanonicalName, getErrors, setBufferSize, setDefaultEncoding, setLocale, setLocaleProviderFactory, setMaxSize
protected Map<String,List<JakartaStreamMultiPartRequest.FileInfo>> fileInfos
public void cleanUp()
MultiPartRequest
public String[] getContentType(String fieldName)
MultiPartRequest
fieldName
- input field namepublic UploadedFile[] getFile(String fieldName)
MultiPartRequest
UploadedFile
object for the filename specified or null if no files
are associated with the given field name.fieldName
- input field namepublic String[] getFileNames(String fieldName)
MultiPartRequest
fieldName
- input field namepublic Enumeration<String> getFileParameterNames()
MultiPartRequest
public String[] getFilesystemName(String fieldName)
MultiPartRequest
fieldName
- input field namepublic String getParameter(String name)
MultiPartRequest
name
- the name of the parameter to getpublic Enumeration<String> getParameterNames()
MultiPartRequest
public String[] getParameterValues(String name)
MultiPartRequest
name
- the name of the parameter.public void parse(javax.servlet.http.HttpServletRequest request, String saveDir) throws IOException
IOException
protected void processUpload(javax.servlet.http.HttpServletRequest request, String saveDir) throws Exception
request
- the servlet requestsaveDir
- location of the save dirException
protected boolean isRequestSizePermitted(javax.servlet.http.HttpServletRequest request)
request
- the servlet requestprotected long getRequestSize(javax.servlet.http.HttpServletRequest request)
request
- the servlet requestprotected void addFileSkippedError(String fileName, javax.servlet.http.HttpServletRequest request)
fileName
- file namerequest
- the servlet requestprotected void processFileItemStreamAsFormField(org.apache.commons.fileupload.FileItemStream itemStream)
itemStream
- file item streamprotected void processFileItemStreamAsFileField(org.apache.commons.fileupload.FileItemStream itemStream, String location)
itemStream
- file item streamlocation
- locationprotected File createTemporaryFile(String fileName, String location) throws IOException
fileName
- file namelocation
- locationIOException
- in case of IO errorsprotected boolean streamFileToDisk(org.apache.commons.fileupload.FileItemStream itemStream, File file) throws IOException
itemStream
- file item streamfile
- the fileIOException
- in case of IO errorsprotected void createFileInfoFromItemStream(org.apache.commons.fileupload.FileItemStream itemStream, File file)
FileInfo
structure used to pass information
to the FileUploadInterceptor
during the interceptor stack
invocation process.itemStream
- file item streamfile
- the fileCopyright © 2000–2020 Apache Software Foundation. All rights reserved.