Package org.forgerock.http.protocol
Class Form
Form fields, a case-sensitive multi-string-valued map. The form can be read
from and written to request objects as query parameters (GET) and request
entities (POST).
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.forgerock.util.MapDecorator
map
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendRequestQuery
(Request request) Appends the form as additional query parameters on an existing request URI.Parses a form URL-encoded string containing form parameters and stores them in this object.Parses a URL-encoded query string containing form parameters and stores them in this object.fromRequestEntity
(Request request) Deprecated.Because Entity content should be read asynchronously.fromRequestQuery
(Request request) Parses the query parameters of a request and stores them in this object.fromString
(String s) Deprecated.usefromFormString(String)
instead.Returns this form in a form URL-encoded string.Returns this form in a URL-encoded query string.void
toRequestEntity
(Request request) Populates a request with the necessary headers and entity for the form to be submitted as a POST with application/x-www-form-urlencoded content type.void
toRequestQuery
(Request request) Sets a request URI with query parameters.toString()
Deprecated.usetoFormString()
instead.Methods inherited from class org.forgerock.http.util.MultiValueMap
add, addAll, addAll, addAll, getFirst, putSingle
Methods inherited from class org.forgerock.util.MapDecorator
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
Form
public Form()Constructs a new, empty form object.
-
-
Method Details
-
fromString
Deprecated.usefromFormString(String)
instead.Parses a form URL-encoded string containing form parameters and stores them in this object. Malformed name-value pairs (missing the "=" delimiter) are simply ignored.- Parameters:
s
- the form URL-encoded string to parse.- Returns:
- this form object.
-
fromFormString
Parses a form URL-encoded string containing form parameters and stores them in this object. Malformed name-value pairs (missing the "=" delimiter) are simply ignored.- Parameters:
s
- the form URL-encoded string to parse.- Returns:
- this form object.
-
fromQueryString
Parses a URL-encoded query string containing form parameters and stores them in this object. Malformed name-value pairs (missing the "=" delimiter) are simply ignored.- Parameters:
s
- the URL-encoded query string to parse.- Returns:
- this form object.
-
toString
Deprecated.usetoFormString()
instead.Returns this form in a form URL-encoded string. -
toFormString
Returns this form in a form URL-encoded string.- Returns:
- the form URL-encoded form.
-
toQueryString
Returns this form in a URL-encoded query string.- Returns:
- the URL-encoded query string.
-
fromRequestQuery
Parses the query parameters of a request and stores them in this object. The object is not cleared beforehand, so this adds to any fields already in place.- Parameters:
request
- the request to be parsed.- Returns:
- this form object.
-
toRequestQuery
Sets a request URI with query parameters. This overwrites any query parameters that may already exist in the request URI.- Parameters:
request
- the request to set query parameters to.
-
appendRequestQuery
Appends the form as additional query parameters on an existing request URI. This leaves any existing query parameters intact.- Parameters:
request
- the request to append query parameters to.
-
fromRequestEntity
Deprecated.Because Entity content should be read asynchronously. Instead retrieve theForm
withEntity.getFormAsync()
.Parses the URL-encoded form entity of a request and stores them in this object. The object is not cleared beforehand, so this adds to any fields already in place.- Parameters:
request
- the request to be parsed.- Returns:
- this form object.
- Throws:
IOException
- if an I/O exception occurs.- See Also:
-
toRequestEntity
Populates a request with the necessary headers and entity for the form to be submitted as a POST with application/x-www-form-urlencoded content type. This overwrites any entity that may already be in the request.- Parameters:
request
- the request to add the form entity to.
-