|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.service.CommonsFileUploadService
public class CommonsFileUploadService
Provides an Apache Commons FileUploadService class.
To prevent users from uploading exceedingly large files you can configure CommonsFileUploadService through the propertiessizeMax
and
fileSizeMax
.
For example:
<file-upload-service> <!-- Set the total request maximum size to 10mb (10 x 1024 x 1024 = 10485760). --> <property name="sizeMax" value="10485760"/> <!-- Set the maximum individual file size to 2mb (2 x 1024 x 1024 = 2097152). --> <property name="fileSizeMax" value="2097152"/> </file-upload-service>Note that this is a global configuration and applies to the all file uploads of the application. If you would like to specify a custom FileUploadService implementation use the classname attribute:
<file-upload-service classname="com.mycorp.util.CustomFileUploadService"> <property name="customProperty" value="customValue"/> </file-upload-service>
Field Summary | |
---|---|
protected long |
fileSizeMax
The maximum individual file size in bytes. |
protected long |
sizeMax
The total request maximum size in bytes. |
Fields inherited from interface org.apache.click.service.FileUploadService |
---|
UPLOAD_EXCEPTION |
Constructor Summary | |
---|---|
CommonsFileUploadService()
|
Method Summary | |
---|---|
FileItemFactory |
createFileItemFactory(HttpServletRequest request)
Create and return a new Commons Upload FileItemFactory instance. |
long |
getFileSizeMax()
Return maximum individual size in bytes. |
long |
getSizeMax()
Return the total request maximum size in bytes. |
void |
onDestroy()
Destroy the FileUploadService. |
void |
onInit(ServletContext servletContext)
Initialize the FileUploadService with the given application servlet context. |
List<FileItem> |
parseRequest(HttpServletRequest request)
Return a parsed list of FileItem from the request. |
void |
setFileSizeMax(long value)
Set the maximum individual size in bytes. |
void |
setSizeMax(long value)
Set the total request maximum size in bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long sizeMax
protected long fileSizeMax
Constructor Detail |
---|
public CommonsFileUploadService()
Method Detail |
---|
public void onInit(ServletContext servletContext) throws Exception
FileUploadService
ConfigService
by invoking
ClickUtils.getConfigService(javax.servlet.ServletContext)
onInit
in interface FileUploadService
servletContext
- the application servlet context
Exception
- if an error occurs initializing the FileUploadServiceFileUploadService.onInit(ServletContext)
public void onDestroy()
FileUploadService
onDestroy
in interface FileUploadService
FileUploadService.onDestroy()
public List<FileItem> parseRequest(HttpServletRequest request) throws FileUploadException
FileUploadService
parseRequest
in interface FileUploadService
request
- the servlet request
FileUploadException
- if request cannot be parsedFileUploadService.parseRequest(HttpServletRequest)
public long getFileSizeMax()
public void setFileSizeMax(long value)
value
- the fileSizeMax to setpublic long getSizeMax()
public void setSizeMax(long value)
value
- the setSizeMax to setpublic FileItemFactory createFileItemFactory(HttpServletRequest request)
request
- the servlet request
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |