com.oktiva.mogno
Class MognoServletRequestWrapper

java.lang.Object
  extended byjavax.servlet.ServletRequestWrapper
      extended byjavax.servlet.http.HttpServletRequestWrapper
          extended bycom.oktiva.mogno.MognoServletRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class MognoServletRequestWrapper
extends javax.servlet.http.HttpServletRequestWrapper

Wrapper to handle multipart/form-data requests Created: Tue Sep 9 17:03:44 2003

Version:
1.0
Author:
oktiva

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
MognoServletRequestWrapper(javax.servlet.http.HttpServletRequest req)
          Create a new wrapper object
 
Method Summary
 org.apache.commons.fileupload.FileItem getFileItem(java.lang.String name)
          Get a part
static javax.servlet.http.HttpServletRequest getHttpServletRequest(javax.servlet.http.HttpServletRequest req)
          Use this method to create the wrapper only if it is needed to.
 java.lang.String getParameter(java.lang.String name)
          Get a parameter value
 java.util.Enumeration getParameterNames()
          Return the names of the parameters
 java.lang.String[] getParameterValues(java.lang.String field)
          Return the values of the parameters
 boolean isMultiPart()
           
static boolean isMultiPart(javax.servlet.http.HttpServletRequest req)
           
 void setRequest(javax.servlet.http.HttpServletRequest req)
          Set the request to wrap
 
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, getLocale, getLocales, getParameterMap, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getParameterMap, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

MognoServletRequestWrapper

public MognoServletRequestWrapper(javax.servlet.http.HttpServletRequest req)
                           throws java.lang.IllegalArgumentException
Create a new wrapper object

Parameters:
req - a HttpServletRequest to wrap
Throws:
java.lang.IllegalArgumentException - if an error occurs while trying to call setRequest(req)
Method Detail

getHttpServletRequest

public static javax.servlet.http.HttpServletRequest getHttpServletRequest(javax.servlet.http.HttpServletRequest req)
                                                                   throws java.lang.IllegalArgumentException
Use this method to create the wrapper only if it is needed to. It will return the original object if method is not post or if content type is not multipart/form-data

Parameters:
req - Original request object
Returns:
a safe HttpServletRequest object
Throws:
java.lang.IllegalArgumentException - if an error occours while trying to create the wrapper object

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest req)
                throws java.lang.IllegalArgumentException
Set the request to wrap

Parameters:
req - the request object
Throws:
java.lang.IllegalArgumentException - if an error occours

getFileItem

public org.apache.commons.fileupload.FileItem getFileItem(java.lang.String name)
Get a part

Parameters:
name - The name of the part
Returns:
the Part

getParameter

public java.lang.String getParameter(java.lang.String name)
Get a parameter value

Parameters:
name - The name of the parameter
Returns:
the value

getParameterNames

public java.util.Enumeration getParameterNames()
Return the names of the parameters

Returns:
an Enumeration of Strings with the parameter names

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String field)
Return the values of the parameters

Returns:
an array with the values

isMultiPart

public boolean isMultiPart()

isMultiPart

public static boolean isMultiPart(javax.servlet.http.HttpServletRequest req)