|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.servlet.JcmsServletFilter com.jalios.jcms.upload.MultipartFilter
public class MultipartFilter
Filter for automatic file upload processing. it wrapper HttpServletRequest to pass any form parameters in usuall form (normally they are not accessible cause JSDK web container are not required to implement RFC1867).
Use filter attribute "uploadDir" to set temporary directory. If there is no attribute, then create a sub directory UPLOAD_DIR in javax.servlet.context.tempdir path.
Use filter attribute "sizeMax" to set max size otherwise use 2048000000L.
Use filter attribute "sizeThreshold" the threshold, in bytes, below which items will be retained in memory and above which they will be stored as a file.. Default value is 4096.
FIXME:FileItem access is done through attributes. By default they are named after the form field name. However you are allowed to supply attributePrefix and/or attributeSuffix that will be used to "decorate" the attribute name. Request parameter is still set with a fake value defined by filter attribute "fakeParam".
Field Summary | |
---|---|
protected javax.servlet.FilterConfig |
config
|
protected File |
directory
|
protected boolean |
initFilter
|
static String |
PROGRESS_STATUS
|
static String |
REVISION
|
protected long |
sizeMax
|
protected int |
sizeThreshold
|
static String |
UPLOAD_DIR
|
static String |
UPLOAD_ERROR
|
Constructor Summary | |
---|---|
MultipartFilter()
|
Method Summary | |
---|---|
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
Wraps the ServletRequest into a MultiPart Request if it contains multipart data. |
static Map<String,String> |
getFileUploadStatus(String field,
String token)
|
void |
init(javax.servlet.FilterConfig cfg)
|
void |
initFileUpload()
Initialise filter's parameter from FilterConfing and JCMS Properties |
protected void |
registerJSONClass(javax.servlet.http.HttpServletRequest request)
Register MultipartRequest class in JSON for use by docChooser.js upload status |
protected javax.servlet.http.HttpServletRequest |
wrapRequest(javax.servlet.http.HttpServletRequest request)
Wrap the request into a MultipartRequest if we are in MultipartContent with upload |
Methods inherited from class com.jalios.jcms.servlet.JcmsServletFilter |
---|
endFilter, initJSONBridge, processFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
public static final String PROGRESS_STATUS
public static final String UPLOAD_ERROR
public static final String UPLOAD_DIR
protected javax.servlet.FilterConfig config
protected File directory
protected int sizeThreshold
protected long sizeMax
protected boolean initFilter
Constructor Detail |
---|
public MultipartFilter()
Method Detail |
---|
public void init(javax.servlet.FilterConfig cfg) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
Filter.init(FilterConfig)
public void initFileUpload() throws javax.servlet.ServletException
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
protected void registerJSONClass(javax.servlet.http.HttpServletRequest request)
request
- current HttpServletRequestprotected javax.servlet.http.HttpServletRequest wrapRequest(javax.servlet.http.HttpServletRequest request) throws org.apache.commons.fileupload.FileUploadException, UnsupportedEncodingException
request
- current HttpServletRequest
org.apache.commons.fileupload.FileUploadException
UnsupportedEncodingException
public void destroy()
destroy
in interface javax.servlet.Filter
Filter.destroy()
public static Map<String,String> getFileUploadStatus(String field, String token)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |