Package org.forgerock.http.protocol
Class Form
- java.lang.Object
-
- org.forgerock.util.MapDecorator<K,List<V>>
-
- org.forgerock.http.util.MultiValueMap<String,String>
-
- org.forgerock.http.protocol.Form
-
-
Field Summary
-
Fields inherited from class org.forgerock.util.MapDecorator
map
-
-
Constructor Summary
Constructors Constructor Description Form()Constructs a new, empty form object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidappendRequestQuery(Request request)Appends the form as additional query parameters on an existing request URI.FormfromFormString(String s)Parses a form URL-encoded string containing form parameters and stores them in this object.FormfromQueryString(String s)Parses a URL-encoded query string containing form parameters and stores them in this object.FormfromRequestEntity(Request request)Deprecated.Because Entity content should be read asynchronously.FormfromRequestQuery(Request request)Parses the query parameters of a request and stores them in this object.FormfromString(String s)Deprecated.usefromFormString(String)instead.StringtoFormString()Returns this form in a form URL-encoded string.StringtoQueryString()Returns this form in a URL-encoded query string.voidtoRequestEntity(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.voidtoRequestQuery(Request request)Sets a request URI with query parameters.StringtoString()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
-
-
-
-
Method Detail
-
fromString
@Deprecated public Form fromString(String s)
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
public Form fromFormString(String s)
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
public Form fromQueryString(String s)
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 public String toString()
Deprecated.usetoFormString()instead.Returns this form in a form URL-encoded string.
-
toFormString
public String toFormString()
Returns this form in a form URL-encoded string.- Returns:
- the form URL-encoded form.
-
toQueryString
public String toQueryString()
Returns this form in a URL-encoded query string.- Returns:
- the URL-encoded query string.
-
fromRequestQuery
public Form fromRequestQuery(Request request)
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
public void toRequestQuery(Request request)
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
public void appendRequestQuery(Request request)
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(since="26.1.0") public Form fromRequestEntity(Request request) throws IOException
Deprecated.Because Entity content should be read asynchronously. Instead retrieve theFormwithEntity.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:
Entity.getFormAsync()
-
toRequestEntity
public 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. This overwrites any entity that may already be in the request.- Parameters:
request- the request to add the form entity to.
-
-