|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.logging.AbstractLogEnabled
org.codehaus.plexus.summit.parameters.BaseRequestParameterParser
Default implementation of a RequestParameterParser. This implementation uses the standard servlet method of parsing query info and post data to assemble a parameter map. In addition, any file uploads are processed and are made available via the returned RequestParameters object.
This component is thread-safe.
Field Summary | |
private java.lang.String |
defaultEncoding
|
private org.apache.commons.fileupload.DiskFileUpload |
fileUpload
A file upload object used to parse uploaded files |
private int |
maxMemorySize
|
private int |
maxUploadSize
|
private java.lang.String |
tempDirectory
|
Fields inherited from class org.codehaus.plexus.logging.AbstractLogEnabled |
|
Fields inherited from interface org.codehaus.plexus.summit.parameters.RequestParameterParser |
ROLE |
Constructor Summary | |
BaseRequestParameterParser()
|
Method Summary | |
protected void |
addFileItem(java.util.Map parameterMap,
java.lang.String name,
org.apache.commons.fileupload.FileItem item)
Add a FileItem to the specified parameter map ensuring that the value is stored as an array of FileItems even if there is only a single parameter. |
protected void |
addParameter(java.util.Map parameterMap,
java.lang.String name,
java.lang.String value)
Add a parameter to the specified parameter map ensuring that the value is stored as an array of Strings even if there is only a single parameter. |
protected void |
doParse(javax.servlet.http.HttpServletRequest request,
java.util.Map parameterMap)
Invoked as part of the parse template method to provide a hook for additional parsing of parameters. |
private java.lang.String |
getFormField(org.apache.commons.fileupload.FileItem item,
java.lang.String encoding)
Get the value of a form field that is part of a FileItem using the specified encoding. |
void |
initialize()
|
RequestParameters |
parse(javax.servlet.http.HttpServletRequest request)
Parses the query info for the parameters associated with this request as well as any uploaded files sent with the HTTP request. |
private void |
processFileUploadItems(javax.servlet.http.HttpServletRequest request,
java.util.Map parameterMap,
java.lang.String encoding)
Process the specified HTTP request for uploaded files sent via a mime multipart request. |
private void |
processQueryInfo(javax.servlet.http.HttpServletRequest request,
java.util.Map parameterMap)
Process the specified HTTP request for name/value pairs encoded within the query info. |
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.fileupload.DiskFileUpload fileUpload
private int maxUploadSize
private int maxMemorySize
private java.lang.String tempDirectory
private java.lang.String defaultEncoding
Constructor Detail |
public BaseRequestParameterParser()
Method Detail |
public void initialize() throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
initialize
in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
public RequestParameters parse(javax.servlet.http.HttpServletRequest request)
SummitRequestParameterParser
instead.
Implementation note: This method is a template method and provides
a hook that implementors may use for additional parsing of the
request. This method does the following:
parse
in interface RequestParameterParser
request
- The HTTP request to parse for parameters.
RequestParameterParser.parse(javax.servlet.http.HttpServletRequest)
protected void doParse(javax.servlet.http.HttpServletRequest request, java.util.Map parameterMap)
request
- The HTTP request to parse for parameters.parameterMap
- A map of the collected parameters which should
be used to store additional parameters in the format described above.
A helper method has been provided to ensure the values are stored
as arrays (see addParameter).private void processFileUploadItems(javax.servlet.http.HttpServletRequest request, java.util.Map parameterMap, java.lang.String encoding)
request
- The HTTP request to be parsed.parameterMap
- The parameter map which is populated with the
uploaded files and/or form fields.encoding
- The encoding to use when decoding a form field
parameter.private void processQueryInfo(javax.servlet.http.HttpServletRequest request, java.util.Map parameterMap)
request
- The HTTP request to be parsed.parameterMap
- The parameter map which is populated with the
parsed name/value pairs.protected void addFileItem(java.util.Map parameterMap, java.lang.String name, org.apache.commons.fileupload.FileItem item)
parameterMap
- The map which the parameter should be added.name
- The name of the parameter.item
- The file item associated with the parameter.protected void addParameter(java.util.Map parameterMap, java.lang.String name, java.lang.String value)
parameterMap
- The map which the parameter should be added.name
- The name of the parameter.value
- The value of the parameter.private java.lang.String getFormField(org.apache.commons.fileupload.FileItem item, java.lang.String encoding)
item
- The file item which contains a form value instead of a file upload.encoding
- The encoding to use when getting the form value.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |