com.taggercat.fileupload
Class FileUploadWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by com.taggercat.fileupload.FileUploadWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class FileUploadWrapper
extends javax.servlet.http.HttpServletRequestWrapper

This class implements a request wrapper on file upload requests. It is based upon the org.apache.commons.fileupload project.

 

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
FileUploadWrapper(javax.servlet.http.HttpServletRequest request, org.apache.commons.fileupload.disk.DiskFileItemFactory fileItemFactory, long maxFileSize)
           
 
Method Summary
 org.apache.commons.fileupload.FileItem getFileItem(java.lang.String fieldName)
           
 java.util.List<org.apache.commons.fileupload.FileItem> getFileItems()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 void parseRequest(org.apache.commons.fileupload.servlet.ServletFileUpload upload, javax.servlet.http.HttpServletRequest request)
           
 java.util.List<java.io.File> saveAllFiles()
          Saves all files to the default temp directory specified by the filter.
 java.util.List<java.io.File> saveAllFiles(java.io.File directory)
          Saves all files to the specified directory, using temporary file names These files are not deleted upon exit.
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

FileUploadWrapper

public FileUploadWrapper(javax.servlet.http.HttpServletRequest request,
                         org.apache.commons.fileupload.disk.DiskFileItemFactory fileItemFactory,
                         long maxFileSize)
Method Detail

getFileItem

public org.apache.commons.fileupload.FileItem getFileItem(java.lang.String fieldName)

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper

parseRequest

public void parseRequest(org.apache.commons.fileupload.servlet.ServletFileUpload upload,
                         javax.servlet.http.HttpServletRequest request)
                  throws java.io.IOException
Throws:
java.io.IOException

saveAllFiles

public java.util.List<java.io.File> saveAllFiles()
                                          throws java.lang.Exception
Saves all files to the default temp directory specified by the filter.

Throws:
java.lang.Exception
Returns:
the list of all saved files

saveAllFiles

public java.util.List<java.io.File> saveAllFiles(java.io.File directory)
                                          throws java.lang.Exception
Saves all files to the specified directory, using temporary file names These files are not deleted upon exit.

Throws:
java.lang.Exception
Parameters:
directory - the directory to save the file to
Returns:
the list of all saved files

getFileItems

public java.util.List<org.apache.commons.fileupload.FileItem> getFileItems()