Class FormFields

java.lang.Object
java.util.concurrent.CompletableFuture<org.eclipse.jetty.util.Fields>
org.eclipse.jetty.io.content.ContentSourceCompletableFuture<org.eclipse.jetty.util.Fields>
org.eclipse.jetty.server.FormFields
All Implemented Interfaces:
Runnable, CompletionStage<org.eclipse.jetty.util.Fields>, Future<org.eclipse.jetty.util.Fields>, org.eclipse.jetty.util.thread.Invocable, org.eclipse.jetty.util.thread.Invocable.Task

public class FormFields extends org.eclipse.jetty.io.content.ContentSourceCompletableFuture<org.eclipse.jetty.util.Fields>

A CompletableFuture that is completed once a application/x-www-form-urlencoded content has been parsed asynchronously from the Content.Source.

Specification.

  • Field Details

  • Method Details

    • getFormEncodedCharset

      public static Charset getFormEncodedCharset(Request request)
    • set

      @Deprecated(forRemoval=true, since="12.0.15") public static void set(Request request, CompletableFuture<org.eclipse.jetty.util.Fields> fields)
      Deprecated, for removal: This API element is subject to removal in a future version.
      do not use it, no replacement.
      Set a Fields or related failure for the request
      Parameters:
      request - The request to which to associate the fields with
      fields - A CompletableFuture that will provide either the fields or a failure.
    • setFields

      public static void setFields(Request request, org.eclipse.jetty.util.Fields fields)
      Set a Fields or related failure for the request
      Parameters:
      request - The request to which to associate the fields with
      fields - A CompletableFuture that will provide either the fields or a failure.
    • getFields

      public static org.eclipse.jetty.util.Fields getFields(Request request)
      Get the Fields from a request. If the Fields have not been set, then attempt to parse them from the Request content, blocking if necessary. If the Fields have previously been read asynchronously by onFields(Request, Promise.Invocable) or similar, then those field will return and this method will not block.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      request - The request to get or read the Fields from
      Returns:
      the Fields
      See Also:
    • getFields

      public static org.eclipse.jetty.util.Fields getFields(Request request, int maxFields, int maxLength)
      Get the Fields from a request. If the Fields have not been set, then attempt to parse them from the Request content, blocking if necessary. If the Fields have previously been read asynchronously by onFields(Request, Promise.Invocable) or similar, then those field will return and this method will not block.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      request - The request to get or read the Fields from
      maxFields - The maximum number of fields to accept or -1 for a default.
      maxLength - The maximum length of fields or -1 for a default.
      Returns:
      the Fields
      See Also:
    • getFields

      public static org.eclipse.jetty.util.Fields getFields(org.eclipse.jetty.io.Content.Source source, org.eclipse.jetty.util.Attributes attributes, Charset charset, int maxFields, int maxLength)
      Get the Fields from a request. If the Fields have not been set, then attempt to parse them from the Request content, blocking if necessary. If the Fields have previously been read asynchronously by onFields(Request, Promise.Invocable) or similar, then those field will return and this method will not block.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      source - The Content.Source from which to read the fields.
      attributes - The Attributes in which to look for an existing CompletableFuture of FormFields, using the classname as the attribute name. If not found the attribute is set with the created CompletableFuture of FormFields.
      charset - the Charset to use for byte to string conversion.
      maxFields - The maximum number of fields to accept or -1 for a default.
      maxLength - The maximum length of fields or -1 for a default.
      Returns:
      the Fields
      See Also:
    • onFields

      public static void onFields(Request request, org.eclipse.jetty.util.Promise.Invocable<org.eclipse.jetty.util.Fields> promise)
      Asynchronously read and parse FormFields from a Request.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      request - The request to get or read the Fields from
      promise - The action to take when the FormFields are available.
      See Also:
    • onFields

      public static void onFields(Request request, Charset charset, org.eclipse.jetty.util.Promise.Invocable<org.eclipse.jetty.util.Fields> promise)
      Asynchronously read and parse FormFields from a Request.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      request - The request to get or read the Fields from
      charset - The Charset of the request content, if previously extracted.
      promise - The action to take when the FormFields are available.
      See Also:
    • onFields

      public static void onFields(Request request, Charset charset, int maxFields, int maxLength, org.eclipse.jetty.util.Promise.Invocable<org.eclipse.jetty.util.Fields> promise)

      Asynchronously reads and parses FormFields from a Request.

      Calls to onFields and getFields methods are idempotent, and can be called multiple times, with subsequent calls returning the results of the first call.

      Parameters:
      request - The request to get or read the Fields from
      charset - The Charset of the request content, if previously extracted.
      maxFields - The maximum number of fields to accept; or -1 for a default.
      maxLength - The maximum length of fields; or -1 for a default.
      promise - The action to take when the FormFields are available.
    • get

      @Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<org.eclipse.jetty.util.Fields> get(Request request)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use getFields(Request) instead.
      Parameters:
      request - The request to enquire from
      Returns:
      A CompletableFuture that will provide either the fields or a failure, or null if none set.
      See Also:
    • from

      @Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<org.eclipse.jetty.util.Fields> from(Request request)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Find or create a FormFields from a Content.Source.
      Parameters:
      request - The Request in which to look for an existing FormFields attribute, using the classname as the attribute name, else the request is used as a Content.Source from which to read the fields and set the attribute.
      Returns:
      A CompletableFuture that will provide the Fields or a failure.
    • from

      @Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<org.eclipse.jetty.util.Fields> from(Request request, Charset charset)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Find or create a FormFields from a Content.Source.
      Parameters:
      request - The Request in which to look for an existing FormFields attribute, using the classname as the attribute name, else the request is used as a Content.Source from which to read the fields and set the attribute.
      charset - the Charset to use for byte to string conversion.
      Returns:
      A CompletableFuture that will provide the Fields or a failure.
    • from

      @Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<org.eclipse.jetty.util.Fields> from(Request request, int maxFields, int maxLength)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Find or create a FormFields from a Content.Source.
      Parameters:
      request - The Request in which to look for an existing FormFields attribute, using the classname as the attribute name, else the request is used as a Content.Source from which to read the fields and set the attribute.
      maxFields - The maximum number of fields to be parsed or -1 for a default.
      maxLength - The maximum total size of the fields or -1 for a default.
      Returns:
      A CompletableFuture that will provide the Fields or a failure.
    • from

      @Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<org.eclipse.jetty.util.Fields> from(Request request, Charset charset, int maxFields, int maxLength)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Find or create a FormFields from a Content.Source.
      Parameters:
      request - The Request in which to look for an existing FormFields attribute, using the classname as the attribute name, else the request is used as a Content.Source from which to read the fields and set the attribute.
      charset - the Charset to use for byte to string conversion.
      maxFields - The maximum number of fields to be parsed or -1 for a default.
      maxLength - The maximum total size of the fields or -1 for a default.
      Returns:
      A CompletableFuture that will provide the Fields or a failure.
    • parse

      protected org.eclipse.jetty.util.Fields parse(org.eclipse.jetty.io.Content.Chunk chunk) throws CharacterCodingException
      Specified by:
      parse in class org.eclipse.jetty.io.content.ContentSourceCompletableFuture<org.eclipse.jetty.util.Fields>
      Throws:
      CharacterCodingException