Class FileUploadFilter
- java.lang.Object
-
- com.twelvemonkeys.servlet.GenericFilter
-
- com.twelvemonkeys.servlet.fileupload.FileUploadFilter
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Filter
,javax.servlet.FilterConfig
public class FileUploadFilter extends GenericFilter
A servletFilter
for processing HTTP file upload requests, as specified by Form-based File Upload in HTML (RFC1867).- Version:
- $Id: FileUploadFilter.java#1 $
- Author:
- Harald Kuhr
- See Also:
HttpFileUploadRequest
, Serialized Form
-
-
Field Summary
-
Fields inherited from class com.twelvemonkeys.servlet.GenericFilter
oncePerRequest
-
-
Constructor Summary
Constructors Constructor Description FileUploadFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doFilterImpl(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse, javax.servlet.FilterChain pChain)
Examines the request content type, and if it is amultipart/*
request, wraps the request with aHttpFileUploadRequest
.void
init()
This method is called by the server before the filter goes into service, and here it determines the file upload directory.void
setMaxFileSize(long pMaxSize)
Sets max filesize allowed for upload.-
Methods inherited from class com.twelvemonkeys.servlet.GenericFilter
destroy, doFilter, getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, log, log, setFilterConfig, setOncePerRequest
-
-
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletException
This method is called by the server before the filter goes into service, and here it determines the file upload directory.- Overrides:
init
in classGenericFilter
- Throws:
javax.servlet.ServletException
- See Also:
GenericFilter.init(FilterConfig)
-
setMaxFileSize
public void setMaxFileSize(long pMaxSize)
Sets max filesize allowed for upload.- Parameters:
pMaxSize
-
-
doFilterImpl
public void doFilterImpl(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse, javax.servlet.FilterChain pChain) throws java.io.IOException, javax.servlet.ServletException
Examines the request content type, and if it is amultipart/*
request, wraps the request with aHttpFileUploadRequest
.- Specified by:
doFilterImpl
in classGenericFilter
- Parameters:
pRequest
- The servlet requestpResponse
- The servlet responsepChain
- The filter chain- Throws:
javax.servlet.ServletException
java.io.IOException
- See Also:
GenericFilter.oncePerRequest
,doFilter
,Filter.doFilter
-
-