Package com.groiss.servlet
Class MultipartRequest
java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
com.groiss.servlet.MultipartRequest
- All Implemented Interfaces:
HttpServletRequest
,ServletRequest
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
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addParameter
(String name, String value) Add a parameter to the parameter list.static MultipartRequest
Create the MultipartRequest from the ServletRequest.static MultipartRequest
abstract Cookie
Get cookie from id (don't iterate the array)abstract File
Return the locally stored temporary file associated with the parameter name given as argument.getFileAndDigest
(String name) Return the locally stored temporary file associated with the parameter name given as argument and also the digest of that file.abstract Enumeration<String>
Return the name of the parameters containing files as values.Returns a list of locally stored temporary files associated with the parameter name given as argument.getFilesAndDigests
(String name) Returns a list of locally stored temporary file associated with the parameter name given as argument and also their digest of that file.abstract String
This method builds a parameter string suitable for a GET request out of the parameter map.abstract String
getRemoteFileName
(String name) Return the remote file name of the file associated with the parameter name given as argument.abstract String
getRemoteFileName
(String name, File temporaryFile) Return the remote file name of the locally stored temporary fileabstract void
removeParameter
(String name) Removes a parameter from the parameter list.abstract void
abstract void
setPathInfo
(String path) Sets the path info.abstract void
setQueryString
(String params, boolean removeParams) Sets the paramters from a query-string.Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
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
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Constructor Details
-
MultipartRequest
-
-
Method Details
-
createInstance
Create the MultipartRequest from the ServletRequest.- Parameters:
req
- the original request
-
createInstanceFormURL
-
getFileNames
Return the name of the parameters containing files as values. -
getFile
Return the locally stored temporary file associated with the parameter name given as argument.- Parameters:
name
- the name of the parameter
-
getFileAndDigest
Return the locally stored temporary file associated with the parameter name given as argument and also the digest of that file.- Parameters:
name
- the name of the parameter
-
getFiles
Returns a list of locally stored temporary files associated with the parameter name given as argument.- Parameters:
name
- the name of the parameter
-
getFilesAndDigests
Returns a list of locally stored temporary file associated with the parameter name given as argument and also their digest of that file.- Parameters:
name
- the name of the parameter
-
getRemoteFileName
Return the remote file name of the file associated with the parameter name given as argument.- Parameters:
name
- the name of the parameter
-
getRemoteFileName
Return the remote file name of the locally stored temporary file- Parameters:
temporaryFile
- the local file
-
addParameter
Add a parameter to the parameter list. If the parameter is already in the list the- Parameters:
name
- the name of the parametervalue
- the value of the parameter
-
removeParameter
Removes a parameter from the parameter list.- Parameters:
name
- the name of the parameter
-
setPathInfo
Sets the path info.- Parameters:
path
- the new path info
-
setQueryString
Sets the paramters from a query-string.- Parameters:
params
- the params in HTTP-GET syntax: param1=value1¶m2=value2removeParams
- if true for each parameter of the query string already existing values are removed.
-
getCookie
Get cookie from id (don't iterate the array) -
getParamsAsLink
This method builds a parameter string suitable for a GET request out of the parameter map.- Returns:
- a String of the form param1=value1¶m2=value2
- Throws:
UnsupportedEncodingException
-
setLocale
-