Package org.restlet.engine.util
Class FormReader
java.lang.Object
org.restlet.engine.util.FormReader
Form reader.
- Author:
- Jerome Louvel
-
Constructor Summary
ConstructorsConstructorDescriptionFormReader(String parametersString, char separator) Constructor.FormReader(String parametersString, CharacterSet characterSet, char separator) Constructor.FormReader(String parametersString, CharacterSet characterSet, char separator, boolean decode) Constructor.FormReader(Representation representation) Constructor.
In case the representation does not define a character set, the UTF-8 character set is used.FormReader(Representation representation, boolean decode) Constructor.
In case the representation does not define a character set, the UTF-8 character set is used. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameters(Series<Parameter> parameters) Adds the parameters into a given series.read()Reads all the parameters.readFirstParameter(String name) Reads the first parameter with the given name.Reads the next parameter available or null.readParameter(String name) Reads the parameters with the given name.voidreadParameters(Map<String, Object> parameters) Reads the parameters whose name is a key in the given map.
-
Constructor Details
-
FormReader
Constructor.
In case the representation does not define a character set, the UTF-8 character set is used.- Parameters:
representation- The web form content.- Throws:
IOException- if the stream of the representation could not be opened.
-
FormReader
Constructor.
In case the representation does not define a character set, the UTF-8 character set is used.- Parameters:
representation- The web form content.decode- Indicates if the parameters should be decoded using the given character set.- Throws:
IOException- if the stream of the representation could not be opened.
-
FormReader
Constructor. Will leave the parsed data encoded.- Parameters:
parametersString- The parameters string.separator- The separator character used between parameters.
-
FormReader
Constructor.- Parameters:
parametersString- The parameters string.characterSet- The supported character encoding. Set to null to leave the data encoded.separator- The separator character used between parameters.
-
FormReader
public FormReader(String parametersString, CharacterSet characterSet, char separator, boolean decode) Constructor.- Parameters:
parametersString- The parameters string.characterSet- The supported character encoding. Set to null to leave the data encoded.separator- The separator character used between parameters.decode- Indicates if the parameters should be decoded using the given character set.
-
-
Method Details
-
addParameters
Adds the parameters into a given series.- Parameters:
parameters- The target parameter series.
-
read
Reads all the parameters.- Returns:
- The form read.
- Throws:
IOException- If the parameters could not be read.
-
readFirstParameter
Reads the first parameter with the given name.- Parameters:
name- The parameter name to match.- Returns:
- The parameter value.
- Throws:
IOException
-
readNextParameter
Reads the next parameter available or null.- Returns:
- The next parameter available or null.
- Throws:
IOException- If the next parameter could not be read.
-
readParameter
Reads the parameters with the given name. If multiple values are found, a list is returned created.- Parameters:
name- The parameter name to match.- Returns:
- The parameter value or list of values.
- Throws:
IOException- If the parameters could not be read.
-
readParameters
Reads the parameters whose name is a key in the given map. If a matching parameter is found, its value is put in the map. If multiple values are found, a list is created and set in the map.- Parameters:
parameters- The parameters map controlling the reading.- Throws:
IOException- If the parameters could not be read.
-