Class Form

All Implemented Interfaces:
Map<String,List<String>>

public class Form extends MultiValueMap<String,String>
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).
  • Constructor Details

    • Form

      public Form()
      Constructs a new, empty form object.
  • Method Details

    • fromString

      @Deprecated public Form fromString(String s)
      Deprecated.
      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.
      use toFormString() instead.
      Returns this form in a form URL-encoded string.
      Overrides:
      toString in class Object
      Returns:
      the form URL-encoded form.
    • 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 the Form with Entity.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

      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.