Package org.apache.struts2.interceptor
Class AbstractFileUploadInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.AbstractFileUploadInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
- Direct Known Subclasses:
- ActionFileUploadInterceptor
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanacceptFile(Object action, UploadedFile file, String originalFilename, String contentType, String inputName) Override for added functionality.protected voidapplyValidation(Object action, MultiPartRequestWrapper multiWrapper) protected StringgetTextMessage(Object action, String messageKey, String[] args) protected StringgetTextMessage(String messageKey, String[] args) protected TextProvidergetTextProvider(Object action) protected booleanisNonEmpty(Object[] objArray) voidsetAllowedExtensions(String allowedExtensions) Sets the allowed extensionsvoidsetAllowedTypes(String allowedTypes) Sets the allowed mimetypesvoidsetContainer(Container container) voidsetMatcher(ContentTypeMatcher<Object> matcher) voidsetMaximumSize(Long maximumSize) Sets the maximum size of an uploaded fileMethods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, intercept, setDisabled, shouldIntercept
- 
Field Details- 
STRUTS_MESSAGES_BYPASS_REQUEST_KEY- See Also:
 
- 
STRUTS_MESSAGES_ERROR_UPLOADING_KEY- See Also:
 
- 
STRUTS_MESSAGES_ERROR_FILE_TOO_LARGE_KEY- See Also:
 
- 
STRUTS_MESSAGES_INVALID_FILE_KEY- See Also:
 
- 
STRUTS_MESSAGES_INVALID_CONTENT_TYPE_KEY- See Also:
 
- 
STRUTS_MESSAGES_ERROR_CONTENT_TYPE_NOT_ALLOWED_KEY- See Also:
 
- 
STRUTS_MESSAGES_ERROR_FILE_EXTENSION_NOT_ALLOWED_KEY- See Also:
 
 
- 
- 
Constructor Details- 
AbstractFileUploadInterceptorpublic AbstractFileUploadInterceptor()
 
- 
- 
Method Details- 
setMatcher
- 
setContainer
- 
setAllowedExtensionsSets the allowed extensions- Parameters:
- allowedExtensions- A comma-delimited list of extensions
 
- 
setAllowedTypesSets the allowed mimetypes- Parameters:
- allowedTypes- A comma-delimited list of types
 
- 
setMaximumSizeSets the maximum size of an uploaded file- Parameters:
- maximumSize- The maximum size in bytes
 
- 
acceptFileprotected boolean acceptFile(Object action, UploadedFile file, String originalFilename, String contentType, String inputName) Override for added functionality. Checks if the proposed file is acceptable based on contentType and size.- Parameters:
- action- - uploading action for message retrieval.
- file- - proposed upload file.
- originalFilename- - name of the file.
- contentType- - contentType of the file.
- inputName- - inputName of the file.
- Returns:
- true if the proposed file is acceptable by contentType and size.
 
- 
isNonEmpty
- 
getTextMessage
- 
getTextMessage
- 
getTextProvider
- 
applyValidation
 
-