org.mentawai.filter
Class FileUploadFilter

java.lang.Object
  extended by org.mentawai.filter.FileUploadFilter
All Implemented Interfaces:
Filter

public class FileUploadFilter
extends Object
implements Filter

A filter for handling File Upload that uses the Jakarta Commons FileUpload library. An org.apache.commons.fileupload.FileItem will be placed in the action input.

Author:
Sergio Oliveira Jr.

Constructor Summary
FileUploadFilter()
           
FileUploadFilter(int maxInMemorySize)
           
FileUploadFilter(int maxInMemorySize, int maxSizeToThrowError)
           
FileUploadFilter(int maxInMemorySize, int maxSizeToThrowError, String tempDirInsideWebInf)
           
FileUploadFilter(int maxInMemorySize, String tempDirInsideWebInf)
           
 
Method Summary
 void destroy()
          Gives a chance to the filter to deallocalte any resources before it is destroyed.
 String filter(InvocationChain chain)
          Executes the filter.
protected  javax.servlet.http.HttpServletRequest getRequest(Action action)
          Because we are using the FileUpload from Jakarta Commons, and because it requires the HttpServletRequest, there is nothing we can do about it besides fetching the HttpServletRequest and giving it to the FileUpload class.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileUploadFilter

public FileUploadFilter()

FileUploadFilter

public FileUploadFilter(int maxInMemorySize)

FileUploadFilter

public FileUploadFilter(int maxInMemorySize,
                        int maxSizeToThrowError)

FileUploadFilter

public FileUploadFilter(int maxInMemorySize,
                        String tempDirInsideWebInf)

FileUploadFilter

public FileUploadFilter(int maxInMemorySize,
                        int maxSizeToThrowError,
                        String tempDirInsideWebInf)
Method Detail

getRequest

protected javax.servlet.http.HttpServletRequest getRequest(Action action)
Because we are using the FileUpload from Jakarta Commons, and because it requires the HttpServletRequest, there is nothing we can do about it besides fetching the HttpServletRequest and giving it to the FileUpload class.

Returns:
The HttpServletRequest of the current request!

filter

public String filter(InvocationChain chain)
              throws Exception
Description copied from interface: Filter
Executes the filter.

Specified by:
filter in interface Filter
Parameters:
chain - The InvocationChain for the action this filter is being applied to.
Returns:
The result of the filter or the action the filter is being applied to.
Throws:
Exception

destroy

public void destroy()
Description copied from interface: Filter
Gives a chance to the filter to deallocalte any resources before it is destroyed. This is called when the web application is stopped, in other words, this has nothing to do with garbage collection.

Specified by:
destroy in interface Filter

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.