Interface UploadService
-
- All Known Implementing Classes:
DefaultUploadService
public interface UploadService
This service handles parsing
multipart/form-dataPOST requests and turning them into form fields and uploaded files. This can be either performed automatically by theorg.apache.fulcrum.parser.ParameterParseror manually by a user definedorg.apache.turbine.modules.Action.- Version:
- $Id$
- Author:
- Rafal Krzewski, Daniel Rall
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_DISPOSITIONHTTP header.static StringCONTENT_TYPEHTTP header.static StringFORM_DATAHTTP header base type modifier.static StringHEADER_ENCODING_DEFAULTThe default value of 'headerEncoding' property (.).static StringHEADER_ENCODING_KEYThe key in UploadService properties in TurbineResources.properties 'headerEncoding' property.static StringMIXEDHTTP header base type modifier.static StringMULTIPARTHTTP header base type.static StringMULTIPART_FORM_DATAHTTP header.static StringMULTIPART_MIXEDHTTP header.static StringREPOSITORY_DEFAULTThe default value of 'repository' property (.).static StringREPOSITORY_KEYThe key in UploadService properties in TurbineResources.properties 'repository' property.static StringREPOSITORY_PARAMETERThe request parameter name for overriding 'repository' property (path).static StringROLEAvalon Identifierstatic intSIZE_MAX_DEFAULTThe default value of 'sizMax' property (1 megabyte = 1048576 bytes).static StringSIZE_MAX_KEYw The key in UploadService properties in service configuration 'sizeMax' property.static intSIZE_THRESHOLD_DEFAULTThe default value of 'sizeThreshold' property (10 kilobytes = 10240 bytes).static StringSIZE_THRESHOLD_KEYThe key in UploadService properties in TurbineResources.properties 'sizeThreshold' property.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetHeaderEncoding()Retrieves the value of theheaderEncodingproperty ofUploadService.org.apache.commons.fileupload.FileItemIteratorgetItemIterator(javax.portlet.ActionRequest req)Processes an RFC 1867 compliantmultipart/form-datastream.org.apache.commons.fileupload.FileItemIteratorgetItemIterator(HttpServletRequest req)Processes an RFC 1867 compliantmultipart/form-datastream.StringgetRepository()Retrieves the value of therepositoryproperty ofUploadService.longgetSizeMax()Retrieves the value ofsize.maxproperty of theUploadService.longgetSizeThreshold()Retrieves the value ofsize.thresholdproperty ofUploadService.booleanisMultipart(javax.portlet.ActionRequest req)Utility method that determines whether the request contains multipart content.booleanisMultipart(HttpServletRequest req)Utility method that determines whether the request contains multipart content.List<org.apache.commons.fileupload.FileItem>parseRequest(javax.portlet.ActionRequest req)Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload.FileItem>parseRequest(javax.portlet.ActionRequest req, int sizeThreshold, int sizeMax, String path)Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload.FileItem>parseRequest(javax.portlet.ActionRequest req, String path)Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload.FileItem>parseRequest(HttpServletRequest req)Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload.FileItem>parseRequest(HttpServletRequest req, int sizeThreshold, int sizeMax, String path)Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload.FileItem>parseRequest(HttpServletRequest req, String path)Parses a RFC 1867 compliantmultipart/form-datastream.
-
-
-
Field Detail
-
CONTENT_TYPE
static final String CONTENT_TYPE
HTTP header.- See Also:
- Constant Field Values
-
CONTENT_DISPOSITION
static final String CONTENT_DISPOSITION
HTTP header.- See Also:
- Constant Field Values
-
MULTIPART
static final String MULTIPART
HTTP header base type.- See Also:
- Constant Field Values
-
FORM_DATA
static final String FORM_DATA
HTTP header base type modifier.- See Also:
- Constant Field Values
-
MIXED
static final String MIXED
HTTP header base type modifier.- See Also:
- Constant Field Values
-
MULTIPART_FORM_DATA
static final String MULTIPART_FORM_DATA
HTTP header.- See Also:
- Constant Field Values
-
MULTIPART_MIXED
static final String MULTIPART_MIXED
HTTP header.- See Also:
- Constant Field Values
-
REPOSITORY_PARAMETER
static final String REPOSITORY_PARAMETER
The request parameter name for overriding 'repository' property (path).- See Also:
- Constant Field Values
-
REPOSITORY_KEY
static final String REPOSITORY_KEY
The key in UploadService properties in TurbineResources.properties 'repository' property.- See Also:
- Constant Field Values
-
REPOSITORY_DEFAULT
static final String REPOSITORY_DEFAULT
The default value of 'repository' property (.). This is the directory where uploaded files will get stored temporarily. Note that "." is whatever the servlet container chooses to be it's 'current directory'.
- See Also:
- Constant Field Values
-
SIZE_MAX_KEY
static final String SIZE_MAX_KEY
w The key in UploadService properties in service configuration 'sizeMax' property.- See Also:
- Constant Field Values
-
SIZE_MAX_DEFAULT
static final int SIZE_MAX_DEFAULT
The default value of 'sizMax' property (1 megabyte = 1048576 bytes). This is the maximum size of POST request that will be parsed by the uploader. If you need to set specific limits for your users, set this property to the largest limit value, and use an action + no auto upload to enforce limits.
- See Also:
- Constant Field Values
-
SIZE_THRESHOLD_KEY
static final String SIZE_THRESHOLD_KEY
The key in UploadService properties in TurbineResources.properties 'sizeThreshold' property.- See Also:
- Constant Field Values
-
SIZE_THRESHOLD_DEFAULT
static final int SIZE_THRESHOLD_DEFAULT
The default value of 'sizeThreshold' property (10 kilobytes = 10240 bytes). This is the maximum size of a POST request that will have it's components stored temporarily in memory, instead of disk.
- See Also:
- Constant Field Values
-
HEADER_ENCODING_KEY
static final String HEADER_ENCODING_KEY
The key in UploadService properties in TurbineResources.properties 'headerEncoding' property.- See Also:
- Constant Field Values
-
HEADER_ENCODING_DEFAULT
static final String HEADER_ENCODING_DEFAULT
The default value of 'headerEncoding' property (.). The value has been decided by copying from DiskFileItem class
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(HttpServletRequest req) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The servlet request to be parsed.- Returns:
- list of file items
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(HttpServletRequest req, String path) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The servlet request to be parsed.path- The location where the files should be stored.- Returns:
- List of FileItem parts
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(HttpServletRequest req, int sizeThreshold, int sizeMax, String path) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The servlet request to be parsed.sizeThreshold- the max size in bytes to be stored in memorysizeMax- the maximum allowed upload size in bytespath- The location where the files should be stored.- Returns:
- List of FileItem parts
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
getItemIterator
org.apache.commons.fileupload.FileItemIterator getItemIterator(HttpServletRequest req) throws org.apache.avalon.framework.service.ServiceException
Processes an RFC 1867 compliantmultipart/form-datastream.- Parameters:
req- The servlet request to be parsed.- Returns:
- An iterator to instances of
FileItemStreamparsed from the request, in the order that they were transmitted. - Throws:
org.apache.avalon.framework.service.ServiceException- if there are problems reading/parsing the request or storing files. This may also be a network error while communicating with the client or a problem while storing the uploaded content.
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(javax.portlet.ActionRequest req) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The portlet request to be parsed.- Returns:
- List of FileItem parts
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(javax.portlet.ActionRequest req, String path) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The portlet request to be parsed.path- The location where the files should be stored.- Returns:
- List of FileItem parts
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
parseRequest
List<org.apache.commons.fileupload.FileItem> parseRequest(javax.portlet.ActionRequest req, int sizeThreshold, int sizeMax, String path) throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867 compliant
multipart/form-datastream.- Parameters:
req- The portlet request to be parsed.sizeThreshold- the max size in bytes to be stored in memorysizeMax- the maximum allowed upload size in bytespath- The location where the files should be stored.- Returns:
- The list of FileItem parts uploaded
- Throws:
org.apache.avalon.framework.service.ServiceException- Problems reading/parsing the request or storing the uploaded file(s).
-
getItemIterator
org.apache.commons.fileupload.FileItemIterator getItemIterator(javax.portlet.ActionRequest req) throws org.apache.avalon.framework.service.ServiceException
Processes an RFC 1867 compliantmultipart/form-datastream.- Parameters:
req- The portlet request to be parsed.- Returns:
- An iterator to instances of
FileItemStreamparsed from the request, in the order that they were transmitted. - Throws:
org.apache.avalon.framework.service.ServiceException- if there are problems reading/parsing the request or storing files. This may also be a network error while communicating with the client or a problem while storing the uploaded content.
-
getSizeMax
long getSizeMax()
Retrieves the value of
size.maxproperty of theUploadService.- Returns:
- The maximum upload size.
-
getSizeThreshold
long getSizeThreshold()
Retrieves the value of
size.thresholdproperty ofUploadService.- Returns:
- The threshold beyond which files are written directly to disk.
-
getRepository
String getRepository()
Retrieves the value of the
repositoryproperty ofUploadService.- Returns:
- The repository.
-
getHeaderEncoding
String getHeaderEncoding()
Retrieves the value of the
headerEncodingproperty ofUploadService.- Returns:
- Returns the headerEncoding.
-
isMultipart
boolean isMultipart(HttpServletRequest req)
Utility method that determines whether the request contains multipart content.- Parameters:
req- The servlet request to be evaluated. Must be non-null.- Returns:
trueif the request is multipart;falseotherwise.
-
isMultipart
boolean isMultipart(javax.portlet.ActionRequest req)
Utility method that determines whether the request contains multipart content.- Parameters:
req- The portlet request to be evaluated. Must be non-null.- Returns:
trueif the request is multipart;falseotherwise.
-
-