Interface UploadService
- All Known Implementing Classes:
- DefaultUploadService
 This service handles parsing multipart/form-data POST requests
 and turning them into form fields and uploaded files. This can be either
 performed automatically by the org.apache.fulcrum.parser.ParameterParser or manually by a user
 defined org.apache.turbine.modules.Action.
- Version:
- $Id$
- Author:
- Rafal Krzewski, Daniel Rall
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringHTTP header.static final StringHTTP header.static final StringHTTP header base type modifier.static final StringThe default value of 'headerEncoding' property (.).static final StringThe key in UploadService properties in TurbineResources.properties 'headerEncoding' property.static final StringHTTP header base type modifier.static final StringHTTP header base type.static final StringHTTP header.static final StringHTTP header.static final StringThe default value of 'repository' property (.).static final StringThe key in UploadService properties in TurbineResources.properties 'repository' property.static final StringThe request parameter name for overriding 'repository' property (path).static final StringAvalon Identifierstatic final intThe default value of 'sizMax' property (1 megabyte = 1048576 bytes).static final Stringw The key in UploadService properties in service configuration 'sizeMax' property.static final intThe default value of 'sizeThreshold' property (10 kilobytes = 10240 bytes).static final StringThe key in UploadService properties in TurbineResources.properties 'sizeThreshold' property.
- 
Method SummaryModifier and TypeMethodDescriptionlongThe maximum allowed size of a sinlge file uploadRetrieves the value of theheaderEncodingproperty ofUploadService.org.apache.commons.fileupload2.core.FileItemInputIteratorgetItemIterator(jakarta.servlet.http.HttpServletRequest req) Processes an RFC 1867 compliantmultipart/form-datastream.Retrieves the value of therepositoryproperty ofUploadService.longRetrieves the value ofsize.maxproperty of theUploadService.longRetrieves the value ofsize.thresholdproperty ofUploadService.booleanisMultipart(jakarta.servlet.http.HttpServletRequest req) Utility method that determines whether the request contains multipart content.List<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.HttpServletRequest req) Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.HttpServletRequest req, int sizeThreshold, int sizeMax, String path) Parses a RFC 1867 compliantmultipart/form-datastream.List<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.HttpServletRequest req, String path) Parses a RFC 1867 compliantmultipart/form-datastream.
- 
Field Details- 
ROLEAvalon Identifier
- 
CONTENT_TYPEHTTP header.- See Also:
 
- 
CONTENT_DISPOSITIONHTTP header.- See Also:
 
- 
MULTIPARTHTTP header base type.- See Also:
 
- 
FORM_DATAHTTP header base type modifier.- See Also:
 
- 
MIXEDHTTP header base type modifier.- See Also:
 
- 
MULTIPART_FORM_DATAHTTP header.- See Also:
 
- 
MULTIPART_MIXEDHTTP header.- See Also:
 
- 
REPOSITORY_PARAMETERThe request parameter name for overriding 'repository' property (path).- See Also:
 
- 
REPOSITORY_KEYThe key in UploadService properties in TurbineResources.properties 'repository' property.- See Also:
 
- 
REPOSITORY_DEFAULTThe 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:
 
- 
SIZE_MAX_KEYw The key in UploadService properties in service configuration 'sizeMax' property.- See Also:
 
- 
SIZE_MAX_DEFAULTstatic final int SIZE_MAX_DEFAULTThe 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:
 
- 
SIZE_THRESHOLD_KEYThe key in UploadService properties in TurbineResources.properties 'sizeThreshold' property.- See Also:
 
- 
SIZE_THRESHOLD_DEFAULTstatic final int SIZE_THRESHOLD_DEFAULTThe 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:
 
- 
HEADER_ENCODING_KEYThe key in UploadService properties in TurbineResources.properties 'headerEncoding' property.- See Also:
 
- 
HEADER_ENCODING_DEFAULTThe default value of 'headerEncoding' property (.). The value has been decided by copying from DiskFileItem class - See Also:
 
 
- 
- 
Method Details- 
parseRequestList<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.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).
 
- 
parseRequestList<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.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).
 
- 
parseRequestList<org.apache.commons.fileupload2.core.FileItem> parseRequest(jakarta.servlet.http.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 memory
- sizeMax- the maximum allowed upload size in bytes
- 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).
 
- 
getItemIteratororg.apache.commons.fileupload2.core.FileItemInputIterator getItemIterator(jakarta.servlet.http.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.
 
- 
getSizeMaxlong getSizeMax()Retrieves the value of size.maxproperty of theUploadService.- Returns:
- The maximum upload size.
 
- 
getSizeThresholdlong getSizeThreshold()Retrieves the value of size.thresholdproperty ofUploadService.- Returns:
- The threshold beyond which files are written directly to disk.
 
- 
getRepositoryString getRepository()Retrieves the value of the repositoryproperty ofUploadService.- Returns:
- The repository.
 
- 
getHeaderEncodingString getHeaderEncoding()Retrieves the value of the headerEncodingproperty ofUploadService.- Returns:
- Returns the headerEncoding.
 
- 
isMultipartboolean isMultipart(jakarta.servlet.http.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.
 
- 
getFileSizeMaxlong getFileSizeMax()The maximum allowed size of a sinlge file upload- Returns:
- the maximum size
 
 
-