- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,List<String>> HttpFields<FormFields>
The
FormFields
represent the URL's Query-String by the notation
originally used by the GET request of the ancient web forms (see
"https://en.wikipedia.org/wiki/Query_string#Web_forms"). Therefore the name
FormFields
, as them web forms provided fields with values (see
"https://en.wikipedia.org/wiki/Form_(HTML)")- See Also:
-
- "https://en.wikipedia.org/wiki/Query_string"
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionInstantiates a new form fields impl.FormFields
(String aHttpFormFields) Initializes the instance with the fields provided by the given HTTP Form-Fields (HTTP Query-String).FormFields
(Map<String, List<String>> aHttpFields) Initializes the instance with the fields provided by the givenMap
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
fromBodyFormFields
(String aHttpFormFields) Processes the HTTP Form-Fields bodyString
and retrieves the therein defined Form-Fields and adds them to theFormFields
instance.void
Extracts the HTTP Query-String from the provided URL by identifying the first question mark ("?")void
fromUrlQueryString
(String aQueryString) Processes the HTTP Query-String and retrieves the therein defined Form-Fields and adds them to theFormFields
instance.Produces an HTTP Form-Fields bodyString
form the herein contain HTTP query fields.int
Calculates the length (number of characters) of theFormFields
when used for a HTTP-Body as oftoBodyFormFields()
.Produces an HTTP Query-String form the herein contain HTTP query fields.Methods inherited from class org.refcodes.web.AbstractHttpFields
copyHttpFields
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.web.HttpFields
addAll, addTo, addTo, addTo, addTo, addTo, addTo, getFirst, getFirst, put, put, put, put, toField, toField, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withPut, withPut, withPut, withPut, withPut, withPut
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
FormFields
public FormFields()Instantiates a new form fields impl. -
FormFields
Initializes the instance with the fields provided by the givenMap
.- Parameters:
aHttpFields
- TheMap
from which to get the keys and values for initializing this instance.
-
FormFields
Initializes the instance with the fields provided by the given HTTP Form-Fields (HTTP Query-String).- Parameters:
aHttpFormFields
- TheString
from which to parse the keys and values for initializing this instance.
-
-
Method Details
-
fromUrlQueryString
Processes the HTTP Query-String and retrieves the therein defined Form-Fields and adds them to theFormFields
instance.- Parameters:
aQueryString
- The HTTP Query-String from which to extract the form being added to theFormFields
instance.
-
fromBodyFormFields
Processes the HTTP Form-Fields bodyString
and retrieves the therein defined Form-Fields and adds them to theFormFields
instance.- Parameters:
aHttpFormFields
- The HTTP Form-FieldsString
from which to extract the form being added to theFormFields
instance.
-
toUrlQueryString
Produces an HTTP Query-String form the herein contain HTTP query fields.- Returns:
- The HTTP Query-String representation of this
FormFields
instance or null if this instance is empty.
-
toBodyFormFields
Produces an HTTP Form-Fields bodyString
form the herein contain HTTP query fields.- Returns:
- The HTTP Form-Fields
String
representation of thisFormFields
instance or null if this instance is empty.
-
toContentLength
public int toContentLength()Calculates the length (number of characters) of theFormFields
when used for a HTTP-Body as oftoBodyFormFields()
.- Returns:
- The length of the HTTP-Body representation of the content of
these
FormFields
.
-
fromUrl
Extracts the HTTP Query-String from the provided URL by identifying the first question mark ("?") and retrieves the therein defined Form-Fields and adds them to theFormFields
instance.- Parameters:
aUrl
- The URL from which to extract the HTTP Query-String which's Form-Fields are to be added to theFormFields
instance.
-