Klasse DefaultParameterParser
- Alle implementierten Schnittstellen:
Iterable<String>
,org.apache.avalon.framework.logger.LogEnabled
,ParameterParser
,ParserServiceSupport
,ValueParser
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$
- Autor:
- Ilkka Priha, Jon S. Stevens, Sean Legassick, Jürgen Hoffmann
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen org.apache.fulcrum.parser.ValueParser
ValueParser.URLCaseFolding
-
Feldübersicht
Von Klasse geerbte Felder org.apache.fulcrum.parser.BaseValueParser
parameters, parserService
Von Schnittstelle geerbte Felder org.apache.fulcrum.parser.ValueParser
DEFAULT_CHARACTER_ENCODING
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreate a new empty instance of ParameterParser.DefaultParameterParser
(String characterEncoding) Create a new empty instance of ParameterParser. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Add a Part object as a parameters.void
dispose()
Disposes the parser.getFileName
(Part part) Convenience fileName utility, which extracts the filename from headerReturn a Part object for the given name.getParts()
Return an array of all Part objects.Part[]
Return an array of Part objects for the given name.Gets the parsed servlet request.byte[]
Gets the uploadData byte[]protected void
handleEncoding
(HttpServletRequest request) void
setRequest
(HttpServletRequest request) Sets the servlet request to the parser.void
setUploadData
(byte[] uploadData) Sets the uploadData byte[]Von Klasse geerbte Methoden org.apache.fulcrum.parser.BaseValueParser
add, add, add, add, add, add, clear, containsKey, convert, convertAndTrim, convertAndTrim, enableLogging, 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, getLogger, getLong, getLong, getLongObject, getLongObject, getLongObjects, getLongs, getNumberFormat, getObject, getObjects, getParam, getString, getString, getStrings, getStrings, getToStringParam, getUrlFolding, isDisposed, isValid, iterator, keySet, putParam, recycle, recycle, remove, setCharacterEncoding, setDateFormat, setLocale, setNumberFormat, setParserService, setProperties, setProperty, setString, setStrings, toString
Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden java.lang.Iterable
forEach, iterator, spliterator
Von Schnittstelle geerbte Methoden org.apache.fulcrum.parser.ValueParser
add, add, add, add, add, add, clear, containsKey, convert, convertAndTrim, convertAndTrim, 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
-
Konstruktordetails
-
DefaultParameterParser
public DefaultParameterParser()Create a new empty instance of ParameterParser. Uses the default character encoding (US-ASCII).To add name/value pairs to this set of parameters, use the
add()
methods. -
DefaultParameterParser
Create a new empty instance of ParameterParser. Takes a character encoding name to use when converting strings to bytes.To add name/value pairs to this set of parameters, use the
add()
methods.- Parameter:
characterEncoding
- The character encoding of strings.
-
-
Methodendetails
-
dispose
public void dispose()Disposes the parser.- Angegeben von:
dispose
in SchnittstelleValueParser
- Setzt außer Kraft:
dispose
in KlasseBaseValueParser
-
getRequest
Gets the parsed servlet request.- Angegeben von:
getRequest
in SchnittstelleParameterParser
- Gibt zurück:
- the parsed servlet request or null.
-
setRequest
Sets the servlet request to the 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 Map. There are convenience methods for retrieving the data as a number of different datatypes. The PATH_INFO data must be a URLEncoded() string.Sets the request character encoding to the parser.
Sets the request encoding, if it is not set and
ParserService.getParameterEncoding()
is set to a non-default valueParserService.PARAMETER_ENCODING_DEFAULT
(ifServletRequest.getCharacterEncoding()
returns null, it has the default set to ISO-8859-1, cft. Servlet 2.4, 2.5, 3.0, 3.1 Specs). This will only succeed, if no data was read yet, cft. spec.To add name/value pairs to this set of parameters, use the
add()
methods.- Angegeben von:
setRequest
in SchnittstelleParameterParser
- Parameter:
request
- An HttpServletRequest.
-
handleEncoding
-
setUploadData
public void setUploadData(byte[] uploadData) Sets the uploadData byte[]- Angegeben von:
setUploadData
in SchnittstelleParameterParser
- Parameter:
uploadData
- A byte[] with data.
-
getUploadData
public byte[] getUploadData()Gets the uploadData byte[]- Angegeben von:
getUploadData
in SchnittstelleParameterParser
- Gibt zurück:
- uploadData A byte[] with data.
-
add
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.- Angegeben von:
add
in SchnittstelleParameterParser
- Parameter:
name
- A String with the name.value
- A Part with the value.
-
getPart
Beschreibung aus Schnittstelle kopiert:ParameterParser
Return a Part object for the given name. If the name does not exist or the object stored is not a Part, return null.- Angegeben von:
getPart
in SchnittstelleParameterParser
- Parameter:
name
- A String with the name.- Gibt zurück:
- A Part.
- Siehe auch:
-
getParts
Beschreibung aus Schnittstelle kopiert:ParameterParser
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.- Angegeben von:
getParts
in SchnittstelleParameterParser
- Parameter:
name
- A String with the name.- Gibt zurück:
- A Part[]
- Siehe auch:
-
getParts
Beschreibung aus Schnittstelle kopiert:ParameterParser
Return an array of all Part objects. If no parts exist or the object stored is not a Part array, return an empty list.- Angegeben von:
getParts
in SchnittstelleParameterParser
- Gibt zurück:
- Collection Collection of parts
-
getFileName
Beschreibung aus Schnittstelle kopiert:ParameterParser
Convenience fileName utility, which extracts the filename from header- Angegeben von:
getFileName
in SchnittstelleParameterParser
- Parameter:
part
- The part which represents the uploaded file- Gibt zurück:
- the fileName String object.
-