- 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
ConstructorsConstructorDescriptionInstantiates 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 TypeMethodDescriptionvoidfromBodyFormFields(String aHttpFormFields) Processes the HTTP Form-Fields bodyStringand retrieves the therein defined Form-Fields and adds them to theFormFieldsinstance.voidExtracts the HTTP Query-String from the provided URL by identifying the first question mark ("?")voidfromUrlQueryString(String aQueryString) Processes the HTTP Query-String and retrieves the therein defined Form-Fields and adds them to theFormFieldsinstance.Produces an HTTP Form-Fields bodyStringform the herein contain HTTP query fields.intCalculates the length (number of characters) of theFormFieldswhen 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
copyHttpFieldsMethods 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, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, withPutMethods 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- TheMapfrom 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- TheStringfrom 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 theFormFieldsinstance.- Parameters:
aQueryString- The HTTP Query-String from which to extract the form being added to theFormFieldsinstance.
-
fromBodyFormFields
Processes the HTTP Form-Fields bodyStringand retrieves the therein defined Form-Fields and adds them to theFormFieldsinstance.- Parameters:
aHttpFormFields- The HTTP Form-FieldsStringfrom which to extract the form being added to theFormFieldsinstance.
-
toUrlQueryString
Produces an HTTP Query-String form the herein contain HTTP query fields.- Returns:
- The HTTP Query-String representation of this
FormFieldsinstance or null if this instance is empty.
-
toBodyFormFields
Produces an HTTP Form-Fields bodyStringform the herein contain HTTP query fields.- Returns:
- The HTTP Form-Fields
Stringrepresentation of thisFormFieldsinstance or null if this instance is empty.
-
toContentLength
public int toContentLength()Calculates the length (number of characters) of theFormFieldswhen 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 theFormFieldsinstance.- Parameters:
aUrl- The URL from which to extract the HTTP Query-String which's Form-Fields are to be added to theFormFieldsinstance.
-