Package org.apache.fulcrum.parser
Interface ParameterParser
-
- All Superinterfaces:
Iterable<String>
,ValueParser
- All Known Implementing Classes:
DefaultParameterParser
public interface ParameterParser extends ValueParser
ParameterParser is an interface to a utility to handle parsing and retrieving the data passed via the GET/POST/PATH_INFO arguments.NOTE: The name= portion of a name=value pair may be converted to lowercase or uppercase when the object is initialized and when new data is added. This behaviour is determined by the url.case.folding property in TurbineResources.properties. Adding a name/value pair may overwrite existing name=value pairs if the names match:
ParameterParser pp = data.getParameters(); pp.add("ERROR",1); pp.add("eRrOr",2); int result = pp.getInt("ERROR");
In the above example, result is 2.- Version:
- $Id$
- Author:
- Ilkka Priha, Jon S. Stevens, Sean Legassick, Jürgen Hoffmann, Thomas Vandahl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.fulcrum.parser.ValueParser
ValueParser.URLCaseFolding
-
-
Field Summary
-
Fields inherited from interface org.apache.fulcrum.parser.ValueParser
DEFAULT_CHARACTER_ENCODING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(String name, Part value)
Add a Part object as a parameters.String
getFileName(Part part)
Convenience fileName utility, which extracts the filename from headerPart
getPart(String name)
Return a Part object for the given name.Collection<Part>
getParts()
Return an array of all Part objects.Part[]
getParts(String name)
Return an array of Part objects for the given name.HttpServletRequest
getRequest()
Gets the parsed servlet request.byte[]
getUploadData()
Gets the uploadData byte[]void
setRequest(HttpServletRequest req)
Sets the servlet request to be parser.void
setUploadData(byte[] uploadData)
Sets the uploadData byte[]-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.apache.fulcrum.parser.ValueParser
add, add, add, add, add, add, clear, containsKey, convert, convertAndTrim, convertAndTrim, dispose, get, getBigDecimal, getBigDecimal, getBigDecimals, getBoolean, getBoolean, getBooleanObject, getBooleanObject, getBooleanObjects, getBooleans, getByte, getByte, getByteObject, getByteObject, getBytes, getCharacterEncoding, getDate, getDate, getDate, getDateFormat, getDouble, getDouble, getDoubleObject, getDoubleObject, getDoubleObjects, getDoubles, getFloat, getFloat, getFloatObject, getFloatObject, getFloatObjects, getFloats, getInt, getInt, getIntObject, getIntObject, getIntObjects, getInts, getKeys, getLocale, getLong, getLong, getLongObject, getLongObject, getLongObjects, getLongs, getNumberFormat, getObject, getObjects, getString, getString, getStrings, getStrings, getUrlFolding, keySet, remove, setCharacterEncoding, setDateFormat, setLocale, setNumberFormat, setProperties, setString, setStrings, toString
-
-
-
-
Method Detail
-
getRequest
HttpServletRequest getRequest()
Gets the parsed servlet request.- Returns:
- the parsed servlet request or null.
-
setRequest
void setRequest(HttpServletRequest req)
Sets the servlet request to be parser. This requires a valid HttpServletRequest object. It will attempt to parse out the GET/POST/PATH_INFO data and store the data into a Hashtable. There are convenience methods for retrieving the data as a number of different datatypes. The PATH_INFO data must be a URLEncoded() string.To add name/value pairs to this set of parameters, use the
add()
methods.- Parameters:
req
- An HttpServletRequest.
-
setUploadData
void setUploadData(byte[] uploadData)
Sets the uploadData byte[]- Parameters:
uploadData
- A byte[] with data.
-
getUploadData
byte[] getUploadData()
Gets the uploadData byte[]- Returns:
- uploadData A byte[] with data.
-
add
void add(String name, Part value)
Add a Part object as a parameters. If there are any Parts already associated with the name, append to the array. The reason for this is that RFC 1867 allows multiple files to be associated with single HTML input element.- Parameters:
name
- A String with the name.value
- A Part with the value.
-
getPart
Part getPart(String name)
Return a Part object for the given name. If the name does not exist or the object stored is not a Part, return null.- Parameters:
name
- A String with the name.- Returns:
- A Part.
-
getParts
Part[] getParts(String name)
Return an array of Part objects for the given name. If the name does not exist or the object stored is not a Part array, return null.- Parameters:
name
- A String with the name.- Returns:
- A Part[].
-
getParts
Collection<Part> getParts()
Return an array of all Part objects. If no parts exist or the object stored is not a Part array, return an empty list.- Returns:
- Collection Collection of parts
-
getFileName
String getFileName(Part part)
Convenience fileName utility, which extracts the filename from header- Parameters:
part
- The part which represents the uploaded file- Returns:
- the fileName String object.
-
-