public class MultipartMap extends HashMap<String,Object>
HttpServletRequest#getParameterXXX()
methods to ease the
processing in
@MultipartConfig
servlets. You can access the normal request
parameters by getParameter(String)
and you can access
multiple request parameter values
by getParameterValues(String)
.
On creation, the MultipartMap
will put itself in the request
scope, identified by the attribute name parts
, so that you can
access the parameters in EL by for example ${parts.fieldname}
where you would have used ${param.fieldname}
. In case of file
fields, the ${parts.filefieldname}
returns
a
.
File
It was a design decision to extend HashMap<String, Object>
instead of having just Map<String, String[]>
and Map<String, File>
properties, because of the
accessibility in Expression Language. Also, when the value is obtained * by
, as will happen in EL, then multiple
parameter values will be converted from get(Object)
String[]
to List<String>
, so that you can use it in the
JSTL fn:contains
function.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
MultipartMap(javax.servlet.http.HttpServletRequest multipartRequest)
Global constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
get(Object key) |
File |
getFile(String name)
Returns uploaded file associated with given request parameter name.
|
String |
getParameter(String name) |
Map<String,String[]> |
getParameterMap() |
Enumeration<String> |
getParameterNames() |
String[] |
getParameterValues(String name) |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode, toString
public MultipartMap(javax.servlet.http.HttpServletRequest multipartRequest) throws javax.servlet.ServletException, IOException
javax.servlet.ServletException
IOException
public String[] getParameterValues(String name)
ServletRequest.getParameterValues(String)
public Enumeration<String> getParameterNames()
ServletRequest.getParameterNames()
public Map<String,String[]> getParameterMap()
ServletRequest.getParameterMap()
public File getFile(String name)
name
- Request parameter name to return the associated uploaded file
for.IllegalArgumentException
- If this field is actually a Text field.Copyright © 2007-2021 Universidade Federal do ParanĂ¡ - UFPR. All Rights Reserved.