|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.upload.DefaultUploadService
public class DefaultUploadService
This class is an implementation of UploadService.
Files will be stored in temporary disk storage on in memory,
depending on request size, and will be available from the org.apache.fulcrum.util.parser.ParameterParser as FileItem objects.
This implementation of UploadService handles multiple
files per single html form, sent using multipart/form-data encoding
type, as specified by RFC 1867. Use org.apache.fulcrum.parser.ParameterParser#getFileItems(String) to
acquire an array of FileItem objects associated with given
html form.
| Field Summary |
|---|
| Fields inherited from interface org.apache.fulcrum.upload.UploadService |
|---|
CONTENT_DISPOSITION, CONTENT_TYPE, FORM_DATA, HEADER_ENCODING_DEFAULT, HEADER_ENCODING_KEY, MIXED, MULTIPART, MULTIPART_FORM_DATA, MULTIPART_MIXED, REPOSITORY_DEFAULT, REPOSITORY_KEY, REPOSITORY_PARAMETER, ROLE, SIZE_MAX_DEFAULT, SIZE_MAX_KEY, SIZE_THRESHOLD_DEFAULT, SIZE_THRESHOLD_KEY |
| Constructor Summary | |
|---|---|
DefaultUploadService()
|
|
| Method Summary | |
|---|---|
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon component lifecycle method |
void |
contextualize(org.apache.avalon.framework.context.Context context)
Avalon component lifecycle method |
String |
getHeaderEncoding()
Retrieves the value of the headerEncoding property of
UploadService. |
org.apache.commons.fileupload.FileItemIterator |
getItemIterator(javax.servlet.http.HttpServletRequest req)
Processes an RFC 1867 compliant multipart/form-data stream. |
String |
getRepository()
The location used to temporarily store files that are larger than the size threshold. |
long |
getSizeMax()
The maximum allowed upload size |
long |
getSizeThreshold()
The threshold beyond which files are written directly to disk. |
void |
initialize()
Avalon component lifecycle method Initializes the service. |
boolean |
isMultipart(javax.servlet.http.HttpServletRequest req)
Utility method that determines whether the request contains multipart content. |
List<org.apache.commons.fileupload.FileItem> |
parseRequest(javax.servlet.http.HttpServletRequest req)
Parses a RFC 1867 compliant multipart/form-data stream. |
protected List<org.apache.commons.fileupload.FileItem> |
parseRequest(javax.servlet.http.HttpServletRequest req,
int sizeMax,
org.apache.commons.fileupload.disk.DiskFileItemFactory factory)
Parses a RFC 1867 compliant multipart/form-data stream. |
List<org.apache.commons.fileupload.FileItem> |
parseRequest(javax.servlet.http.HttpServletRequest req,
int sizeThreshold,
int sizeMax,
String path)
Parses a RFC 1867 compliant multipart/form-data stream. |
List<org.apache.commons.fileupload.FileItem> |
parseRequest(javax.servlet.http.HttpServletRequest req,
String path)
Parses a RFC 1867 compliant multipart/form-data stream. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultUploadService()
| Method Detail |
|---|
public long getSizeMax()
getSizeMax in interface UploadServicepublic long getSizeThreshold()
getSizeThreshold in interface UploadServicepublic String getRepository()
getRepository in interface UploadServicepublic String getHeaderEncoding()
UploadService Retrieves the value of the headerEncoding property of
UploadService.
getHeaderEncoding in interface UploadService
public List<org.apache.commons.fileupload.FileItem> parseRequest(javax.servlet.http.HttpServletRequest req)
throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867
compliant multipart/form-data stream.
parseRequest in interface UploadServicereq - The servlet request to be parsed.
org.apache.avalon.framework.service.ServiceException - Problems reading/parsing the
request or storing the uploaded file(s).
public List<org.apache.commons.fileupload.FileItem> parseRequest(javax.servlet.http.HttpServletRequest req,
String path)
throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867
compliant multipart/form-data stream.
parseRequest in interface UploadServicereq - The servlet request to be parsed.path - The location where the files should be stored.
org.apache.avalon.framework.service.ServiceException - Problems reading/parsing the
request or storing the uploaded file(s).
public List<org.apache.commons.fileupload.FileItem> parseRequest(javax.servlet.http.HttpServletRequest req,
int sizeThreshold,
int sizeMax,
String path)
throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867
compliant multipart/form-data stream.
parseRequest in interface UploadServicereq - 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.
org.apache.avalon.framework.service.ServiceException - Problems reading/parsing the
request or storing the uploaded file(s).
protected List<org.apache.commons.fileupload.FileItem> parseRequest(javax.servlet.http.HttpServletRequest req,
int sizeMax,
org.apache.commons.fileupload.disk.DiskFileItemFactory factory)
throws org.apache.avalon.framework.service.ServiceException
Parses a RFC 1867
compliant multipart/form-data stream.
req - The servlet request to be parsed.sizeMax - the maximum allowed upload size in bytesfactory - the file item factory to use
org.apache.avalon.framework.service.ServiceException - Problems reading/parsing the
request or storing the uploaded file(s).
public org.apache.commons.fileupload.FileItemIterator getItemIterator(javax.servlet.http.HttpServletRequest req)
throws org.apache.avalon.framework.service.ServiceException
multipart/form-data stream.
getItemIterator in interface UploadServicereq - The servlet request to be parsed.
FileItemStream
parsed from the request, in the order that they were
transmitted.
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.public boolean isMultipart(javax.servlet.http.HttpServletRequest req)
isMultipart in interface UploadServicereq - The servlet request to be evaluated. Must be non-null.
true if the request is multipart;
false otherwise.public void configure(org.apache.avalon.framework.configuration.Configuration conf)
configure in interface org.apache.avalon.framework.configuration.Configurable
public void initialize()
throws Exception
initialize in interface org.apache.avalon.framework.activity.InitializableException
public void contextualize(org.apache.avalon.framework.context.Context context)
throws org.apache.avalon.framework.context.ContextException
contextualize in interface org.apache.avalon.framework.context.Contextualizableorg.apache.avalon.framework.context.ContextException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||