Package org.restlet.data
Class Form
- java.lang.Object
-
- org.restlet.util.WrapperList<T>
-
- org.restlet.util.Series<Parameter>
-
- org.restlet.data.Form
-
-
Field Summary
-
Fields inherited from class org.restlet.util.Series
EMPTY_VALUE
-
-
Constructor Summary
Constructors Constructor Description Form()
Empty constructor.Form(int initialCapacity)
Constructor.Form(java.lang.String queryString)
Constructor.Form(java.lang.String queryString, boolean decode)
Constructor.Form(java.lang.String parametersString, char separator)
Constructor.Form(java.lang.String parametersString, char separator, boolean decode)
Constructor.Form(java.lang.String queryString, CharacterSet characterSet)
Constructor.Form(java.lang.String queryString, CharacterSet characterSet, boolean decode)
Constructor.Form(java.lang.String parametersString, CharacterSet characterSet, char separator)
Constructor.Form(java.lang.String parametersString, CharacterSet characterSet, char separator, boolean decode)
Constructor.Form(java.util.List<Parameter> delegate)
Constructor.Form(Representation webForm)
Constructor.Form(Representation webForm, boolean decode)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parameter
createEntry(java.lang.String name, java.lang.String value)
Creates a new entry.java.lang.String
encode()
Encodes the form using the standard URI encoding mechanism and the UTF-8 character set.java.lang.String
encode(CharacterSet characterSet)
URL encodes the form.java.lang.String
encode(CharacterSet characterSet, char separator)
URL encodes the form.java.lang.String
getMatrixString()
Formats the form as a matrix path string.java.lang.String
getMatrixString(CharacterSet characterSet)
Formats the form as a query string.java.lang.String
getQueryString()
Formats the form as a query string.java.lang.String
getQueryString(CharacterSet characterSet)
Formats the form as a query string.Representation
getWebRepresentation()
Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM).Representation
getWebRepresentation(CharacterSet characterSet)
Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM).-
Methods inherited from class org.restlet.util.Series
add, copyTo, getFirst, getFirst, getFirstValue, getFirstValue, getFirstValue, getFirstValue, getNames, getValues, getValues, getValuesArray, getValuesArray, getValuesArray, getValuesArray, getValuesMap, removeAll, removeAll, removeFirst, removeFirst, set, set, subList, subList, subList, unmodifiableSeries
-
Methods inherited from class org.restlet.util.WrapperList
add, add, addAll, addAll, clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
Form
public Form()
Empty constructor.
-
Form
public Form(int initialCapacity)
Constructor.- Parameters:
initialCapacity
- The initial list capacity.
-
Form
public Form(java.util.List<Parameter> delegate)
Constructor.- Parameters:
delegate
- The delegate list.
-
Form
public Form(Representation webForm)
Constructor.- Parameters:
webForm
- The URL encoded Web form.
-
Form
public Form(Representation webForm, boolean decode)
Constructor.- Parameters:
webForm
- The URL encoded Web form.
-
Form
public Form(java.lang.String queryString)
Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.- Parameters:
queryString
- The Web form parameters as a string.
-
Form
public Form(java.lang.String queryString, boolean decode)
Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.- Parameters:
queryString
- The Web form parameters as a string.decode
- Indicates if the names and values should be automatically decoded.
-
Form
public Form(java.lang.String parametersString, char separator)
Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.- Parameters:
parametersString
- The parameters string to parse.separator
- The separator character to append between parameters.
-
Form
public Form(java.lang.String parametersString, char separator, boolean decode)
Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.- Parameters:
parametersString
- The parameters string to parse.separator
- The separator character to append between parameters.decode
- Indicates if the names and values should be automatically decoded.
-
Form
public Form(java.lang.String queryString, CharacterSet characterSet)
Constructor.- Parameters:
queryString
- The Web form parameters as a string.characterSet
- The supported character encoding.
-
Form
public Form(java.lang.String queryString, CharacterSet characterSet, boolean decode)
Constructor.- Parameters:
queryString
- The Web form parameters as a string.characterSet
- The supported character encoding.decode
- Indicates if the names and values should be automatically decoded.
-
Form
public Form(java.lang.String parametersString, CharacterSet characterSet, char separator)
Constructor.- Parameters:
parametersString
- The parameters string to parse.characterSet
- The supported character encoding.separator
- The separator character to append between parameters.
-
Form
public Form(java.lang.String parametersString, CharacterSet characterSet, char separator, boolean decode)
Constructor.- Parameters:
parametersString
- The parameters string to parse.characterSet
- The supported character encoding.separator
- The separator character to append between parameters.decode
- Indicates if the names and values should be automatically decoded.
-
-
Method Detail
-
createEntry
public Parameter createEntry(java.lang.String name, java.lang.String value)
Description copied from class:Series
Creates a new entry.- Overrides:
createEntry
in classSeries<Parameter>
- Parameters:
name
- The name of the entry.value
- The value of the entry.- Returns:
- A new entry.
-
encode
public java.lang.String encode() throws java.io.IOException
Encodes the form using the standard URI encoding mechanism and the UTF-8 character set.- Returns:
- The encoded form.
- Throws:
java.io.IOException
-
encode
public java.lang.String encode(CharacterSet characterSet) throws java.io.IOException
URL encodes the form. The '&' character is used as a separator.- Parameters:
characterSet
- The supported character encoding.- Returns:
- The encoded form.
- Throws:
java.io.IOException
-
encode
public java.lang.String encode(CharacterSet characterSet, char separator) throws java.io.IOException
URL encodes the form.- Parameters:
characterSet
- The supported character encoding.separator
- The separator character to append between parameters.- Returns:
- The encoded form.
- Throws:
java.io.IOException
-
getMatrixString
public java.lang.String getMatrixString()
Formats the form as a matrix path string. Uses UTF-8 as the character set for encoding non-ASCII characters.- Returns:
- The form as a matrix string.
- See Also:
- Matrix URIs by Tim Berners Lee
-
getMatrixString
public java.lang.String getMatrixString(CharacterSet characterSet)
Formats the form as a query string.- Parameters:
characterSet
- The supported character encoding.- Returns:
- The form as a matrix string.
- See Also:
- Matrix URIs by Tim Berners Lee
-
getQueryString
public java.lang.String getQueryString()
Formats the form as a query string. Uses UTF-8 as the character set for encoding non-ASCII characters.- Returns:
- The form as a query string.
-
getQueryString
public java.lang.String getQueryString(CharacterSet characterSet)
Formats the form as a query string.- Parameters:
characterSet
- The supported character encoding.- Returns:
- The form as a query string.
-
getWebRepresentation
public Representation getWebRepresentation()
Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM). Uses UTF-8 as the character set for encoding non-ASCII characters.- Returns:
- The form as a Web representation.
-
getWebRepresentation
public Representation getWebRepresentation(CharacterSet characterSet)
Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM).- Parameters:
characterSet
- The supported character encoding.- Returns:
- The form as a Web representation.
-
-