com.groiss.servlet
Class MultipartRequest

java.lang.Object
  extended by com.groiss.servlet.MultipartRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public abstract class MultipartRequest
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest

A wrapper of HttpServletRequest with additional methods to handle files and adding and removing parameters. Note that the createInstnace method must be called before any method of the original SerlvetRequest is called.


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
MultipartRequest()
           
 
Method Summary
abstract  void addParameter(java.lang.String name, java.lang.String value)
          Add a parameter to the parameter list.
static MultipartRequest createInstance(javax.servlet.http.HttpServletRequest req)
          Crete the MultipartRequest from the ServletRequest.
abstract  javax.servlet.http.Cookie getCookie(java.lang.String id)
          Get cookie from id (don't iterate the array)
abstract  java.io.File getFile(java.lang.String name)
          Return the locally stored temporary file associated with the parameter name given as argument.
abstract  java.util.Enumeration getFileNames()
          Return the name of the parameters containing files as values.
abstract  java.util.Hashtable getFiles()
          Deprecated.  
abstract  java.lang.String getParamsAsLink()
          This method builds a parameter string suitable for a GET request out of the parameter map.
abstract  java.lang.String getRemoteFileName(java.lang.String name)
          Return the remote file name of the file associated with the parameter name given as argument.
abstract  void removeParameter(java.lang.String name)
          Removes a parameter from the parameter list.
abstract  void setPathInfo(java.lang.String path)
          Sets the path info.
abstract  void setQueryString(java.lang.String params, boolean removeParams)
          Sets the paramters from a query-string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
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 interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

MultipartRequest

public MultipartRequest()
Method Detail

createInstance

public static MultipartRequest createInstance(javax.servlet.http.HttpServletRequest req)
Crete the MultipartRequest from the ServletRequest.

Parameters:
req - the original request

getFileNames

public abstract java.util.Enumeration getFileNames()
Return the name of the parameters containing files as values.


getFile

public abstract java.io.File getFile(java.lang.String name)
Return the locally stored temporary file associated with the parameter name given as argument.

Parameters:
name - the name of the parameter

getRemoteFileName

public abstract java.lang.String getRemoteFileName(java.lang.String name)
Return the remote file name of the file associated with the parameter name given as argument.

Parameters:
name - the name of the parameter

addParameter

public abstract void addParameter(java.lang.String name,
                                  java.lang.String value)
Add a parameter to the parameter list. If the parameter is already in the list the

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

removeParameter

public abstract void removeParameter(java.lang.String name)
Removes a parameter from the parameter list.

Parameters:
name - the name of the parameter

setPathInfo

public abstract void setPathInfo(java.lang.String path)
Sets the path info.

Parameters:
path - the new path info

setQueryString

public abstract void setQueryString(java.lang.String params,
                                    boolean removeParams)
Sets the paramters from a query-string.

Parameters:
params - the params in HTTP-GET syntax: param1=value1¶m2=value2
removeParams - if true for each parameter of the query string already existing values are removed.

getCookie

public abstract javax.servlet.http.Cookie getCookie(java.lang.String id)
Get cookie from id (don't iterate the array)


getParamsAsLink

public abstract java.lang.String getParamsAsLink()
                                          throws java.io.UnsupportedEncodingException
This method builds a parameter string suitable for a GET request out of the parameter map.

Returns:
a String of the form param1=value1&param2=value2
Throws:
java.io.UnsupportedEncodingException

getFiles

@Deprecated
public abstract java.util.Hashtable getFiles()
Deprecated. 



@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.