|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectServletRequestWrapper
HttpServletRequestWrapper
hirondelle.fish.exercise.fileupload.FileUploadWrapper
public class FileUploadWrapper
Wrapper for a file upload request.
File upload requests are not handled graciously by the Servlet API. This class is used as a wrapper around the underlying file upload request, to allow it to behave much as a regular request.
This class uses the Apache Commons File Upload tool. The generous Apache License will very likely allow you to use it in your applications as well.
Field Summary |
---|
Fields inherited from interface HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
FileUploadWrapper(HttpServletRequest aRequest)
Constructor. |
Method Summary | |
---|---|
FileItem |
getFileItem(String aFieldName)
Return the FileItem of the given name. |
List<FileItem> |
getFileItems()
Return a List<FileItem> , in the same order as they appear
in the underlying request. |
String |
getParameter(String aName)
Return the parameter value. |
Map |
getParameterMap()
Return a Map<String, String[]> for all regular parameters. |
Enumeration |
getParameterNames()
Return all request parameter names, for both regular controls and file upload controls. |
String[] |
getParameterValues(String aName)
Return the parameter values. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUploadWrapper(HttpServletRequest aRequest) throws IOException
IOException
Method Detail |
---|
public Enumeration getParameterNames()
Returning the name of file upload controls allows checking of the returned
param names versus a 'white list' of expected names. This increases security,
which is especially important for file upload forms.
See ApplicationFirewallImpl
as well.
Does not include query params passed to request.getRequestDispatcher(String).
getParameterNames
in interface ServletRequest
getParameterNames
in class ServletRequestWrapper
public String getParameter(String aName)
If the parameter is not present in the underlying request, then null is returned.
If the parameter is present, but has no associated value, then an empty string is returned.
If the parameter is multivalued, return the first value that appears in the request.
getParameter
in interface ServletRequest
getParameter
in class ServletRequestWrapper
public String[] getParameterValues(String aName)
Does not include query params passed to request.getRequestDispatcher(String).
getParameterValues
in interface ServletRequest
getParameterValues
in class ServletRequestWrapper
public Map getParameterMap()
Map<String, String[]>
for all regular parameters.
Does not return any file upload paramters at all.
Does not include query params passed to
request.getRequestDispatcher(String).
getParameterMap
in interface ServletRequest
getParameterMap
in class ServletRequestWrapper
public List<FileItem> getFileItems()
List<FileItem>
, in the same order as they appear
in the underlying request.
public FileItem getFileItem(String aFieldName)
FileItem
of the given name.
If the name is unknown, then return null.
|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |