Class AbstractMultiPartRequest
java.lang.Object
org.apache.struts2.dispatcher.multipart.AbstractMultiPartRequest
- All Implemented Interfaces:
MultiPartRequest
- Direct Known Subclasses:
JakartaMultiPartRequest
,JakartaStreamMultiPartRequest
Abstract class with some helper methods, it should be used
when starting development of another implementation of
MultiPartRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Defines the internal buffer size used during streaming operations.protected int
Specifies the buffer size to use during streaming.protected String
protected Locale
Localization to be used regarding errors.protected List<LocalizedMessage>
Internal list of raised errors to be passed to the the Struts2 framework.protected Long
Specifies the maximum number of files in one request.protected Long
Specifies the maximum size per file in the request.protected Long
Specifies the maximum size of the entire request.protected Long
Specifies the maximum length of a string parameter in a multipart request.protected static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalizedMessage
buildErrorMessage
(Throwable e, Object[] args) Build error message.protected String
getCanonicalName
(String originalFileName) Returns a list of error messages that may have occurred while processing the request.void
setBufferSize
(String bufferSize) void
setDefaultEncoding
(String enc) protected void
setLocale
(jakarta.servlet.http.HttpServletRequest request) void
setLocaleProviderFactory
(LocaleProviderFactory localeProviderFactory) void
setMaxFiles
(String maxFiles) void
setMaxFileSize
(String maxFileSize) void
setMaxSize
(String maxSize) void
setMaxStringLength
(String maxStringLength) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.struts2.dispatcher.multipart.MultiPartRequest
cleanUp, getContentType, getFile, getFileNames, getFileParameterNames, getFilesystemName, getParameter, getParameterNames, getParameterValues, parse
-
Field Details
-
STRUTS_MESSAGES_UPLOAD_ERROR_PARAMETER_TOO_LONG_KEY
- See Also:
-
BUFFER_SIZE
public static final int BUFFER_SIZEDefines the internal buffer size used during streaming operations.- See Also:
-
errors
Internal list of raised errors to be passed to the the Struts2 framework. -
maxSize
Specifies the maximum size of the entire request. -
maxFiles
Specifies the maximum number of files in one request. -
maxStringLength
Specifies the maximum length of a string parameter in a multipart request. -
maxFileSize
Specifies the maximum size per file in the request. -
bufferSize
protected int bufferSizeSpecifies the buffer size to use during streaming. -
defaultEncoding
-
defaultLocale
Localization to be used regarding errors.
-
-
Constructor Details
-
AbstractMultiPartRequest
public AbstractMultiPartRequest()
-
-
Method Details
-
setBufferSize
- Parameters:
bufferSize
- Sets the buffer size to be used.
-
setDefaultEncoding
-
setMaxSize
- Parameters:
maxSize
- Injects the Struts multipart request maximum size.
-
setMaxFiles
-
setMaxFileSize
-
setMaxStringLength
-
setLocaleProviderFactory
-
setLocale
protected void setLocale(jakarta.servlet.http.HttpServletRequest request) - Parameters:
request
- Inspect the servlet request and set the locale if one wasn't provided by the Struts2 framework.
-
buildErrorMessage
Build error message.- Parameters:
e
- the Throwable/Exceptionargs
- arguments- Returns:
- error message
-
getErrors
Description copied from interface:MultiPartRequest
Returns a list of error messages that may have occurred while processing the request. If there are no errors, an empty list is returned. If the underlying implementation (ie: cos, jakarta, etc) cannot support providing these errors, an empty list is also returned. This list of errors is reported back to theMultiPartRequestWrapper
's errors field.- Specified by:
getErrors
in interfaceMultiPartRequest
- Returns:
- a list of Strings that represent various errors during parsing
-
getCanonicalName
- Parameters:
originalFileName
- file name- Returns:
- the canonical name based on the supplied filename
-