Class FormFields

All Implemented Interfaces:
Serializable, Cloneable, Map<String,List<String>>, HttpFields<FormFields>

public class FormFields extends AbstractHttpFields<FormFields> implements 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:
  • Constructor Details

    • FormFields

      public FormFields()
      Instantiates a new form fields impl.
    • FormFields

      public FormFields(Map<String,List<String>> aHttpFields)
      Initializes the instance with the fields provided by the given Map.
      Parameters:
      aHttpFields - The Map from which to get the keys and values for initializing this instance.
    • FormFields

      public FormFields(String aHttpFormFields)
      Initializes the instance with the fields provided by the given HTTP Form-Fields (HTTP Query-String).
      Parameters:
      aHttpFormFields - The String from which to parse the keys and values for initializing this instance.
  • Method Details

    • fromUrlQueryString

      public void fromUrlQueryString(String aQueryString)
      Processes the HTTP Query-String and retrieves the therein defined Form-Fields and adds them to the FormFields instance.
      Parameters:
      aQueryString - The HTTP Query-String from which to extract the form being added to the FormFields instance.
    • fromBodyFormFields

      public void fromBodyFormFields(String aHttpFormFields)
      Processes the HTTP Form-Fields body String and retrieves the therein defined Form-Fields and adds them to the FormFields instance.
      Parameters:
      aHttpFormFields - The HTTP Form-Fields String from which to extract the form being added to the FormFields instance.
    • toUrlQueryString

      public String 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

      public String toBodyFormFields()
      Produces an HTTP Form-Fields body String form the herein contain HTTP query fields.
      Returns:
      The HTTP Form-Fields String representation of this FormFields instance or null if this instance is empty.
    • toContentLength

      public int toContentLength()
      Calculates the length (number of characters) of the FormFields when used for a HTTP-Body as of toBodyFormFields().
      Returns:
      The length of the HTTP-Body representation of the content of these FormFields.
    • fromUrl

      public void fromUrl(String aUrl)
      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 the FormFields instance.
      Parameters:
      aUrl - The URL from which to extract the HTTP Query-String which's Form-Fields are to be added to the FormFields instance.