Class FormFields
- All Implemented Interfaces:
Runnable
,CompletionStage<Fields>
,Future<Fields>
,Invocable
,Invocable.Task
A CompletableFuture
that is completed once a application/x-www-form-urlencoded
content has been parsed asynchronously from the Content.Source
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable.Task
Invocable.Task.Abstract
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
static final String
static final int
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<Fields>
Deprecated, for removal: This API element is subject to removal in a future version.static CompletableFuture<Fields>
Deprecated, for removal: This API element is subject to removal in a future version.static CompletableFuture<Fields>
Deprecated, for removal: This API element is subject to removal in a future version.static CompletableFuture<Fields>
Deprecated, for removal: This API element is subject to removal in a future version.static CompletableFuture<Fields>
Deprecated, for removal: This API element is subject to removal in a future version.static Fields
Get the Fields from a request.static Fields
Get the Fields from a request.static Charset
getFormEncodedCharset
(Request request) static void
onFields
(Request request, Charset charset, Promise.Invocable<Fields> promise) Asynchronously read and parse FormFields from aRequest
.static void
onFields
(Request request, Promise.Invocable<Fields> promise) Asynchronously read and parse FormFields from aRequest
.protected Fields
parse
(Content.Chunk chunk) Called byContentSourceCompletableFuture.parse()
to parse aContent.Chunk
.static void
set
(Request request, CompletableFuture<Fields> fields) Deprecated, for removal: This API element is subject to removal in a future version.static void
Set aFields
or related failure for the requestMethods inherited from class org.eclipse.jetty.io.content.ContentSourceCompletableFuture
acceptEither, applyToEither, get, get, getInvocationType, handle, join, onTransientFailure, parse, run, runAfterBoth, runAfterEither, thenAccept, thenAcceptBoth, thenApply, thenCombine, thenCompose, thenRun, whenComplete
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, getNow, getNumberOfDependents, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBothAsync, runAfterBothAsync, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAcceptAsync, thenAcceptAsync, thenAcceptBothAsync, thenAcceptBothAsync, thenApplyAsync, thenApplyAsync, thenCombineAsync, thenCombineAsync, thenComposeAsync, thenComposeAsync, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenCompleteAsync, whenCompleteAsync
-
Field Details
-
MAX_FIELDS_ATTRIBUTE
- See Also:
-
MAX_LENGTH_ATTRIBUTE
- See Also:
-
MAX_FIELDS_DEFAULT
public static final int MAX_FIELDS_DEFAULT- See Also:
-
MAX_LENGTH_DEFAULT
public static final int MAX_LENGTH_DEFAULT- See Also:
-
-
Method Details
-
getFormEncodedCharset
-
set
@Deprecated(forRemoval=true, since="12.0.15") public static void set(Request request, CompletableFuture<Fields> fields) Deprecated, for removal: This API element is subject to removal in a future version.Set aFields
or related failure for the request- Parameters:
request
- The request to which to associate the fields withfields
- ACompletableFuture
that will provide either the fields or a failure.
-
setFields
Set aFields
or related failure for the request- Parameters:
request
- The request to which to associate the fields withfields
- ACompletableFuture
that will provide either the fields or a failure.
-
getFields
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 byonFields(Request, Promise.Invocable)
or similar, then those field will return and this method will not block.Calls to
onFields
andgetFields
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
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 byonFields(Request, Promise.Invocable)
or similar, then those field will return and this method will not block.Calls to
onFields
andgetFields
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 frommaxFields
- The maximum number of fields to acceptmaxLength
- The maximum length of fields- Returns:
- the Fields
- See Also:
-
onFields
Asynchronously read and parse FormFields from aRequest
.Calls to
onFields
andgetFields
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 frompromise
- The action to take when theFormFields
are available.- See Also:
-
onFields
Asynchronously read and parse FormFields from aRequest
.Calls to
onFields
andgetFields
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 fromcharset
- TheCharset
of the request content, if previously extracted.promise
- The action to take when the FormFields are available.- See Also:
-
get
@Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<Fields> get(Request request) Deprecated, for removal: This API element is subject to removal in a future version.- 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<Fields> from(Request request) Deprecated, for removal: This API element is subject to removal in a future version.Find or create aFormFields
from aContent.Source
.- Parameters:
request
- TheRequest
in which to look for an existingFormFields
attribute, using the classname as the attribute name, else the request is used as aContent.Source
from which to read the fields and set the attribute.- Returns:
- A
CompletableFuture
that will provide theFields
or a failure.
-
from
@Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<Fields> from(Request request, Charset charset) Deprecated, for removal: This API element is subject to removal in a future version.Find or create aFormFields
from aContent.Source
.- Parameters:
request
- TheRequest
in which to look for an existingFormFields
attribute, using the classname as the attribute name, else the request is used as aContent.Source
from which to read the fields and set the attribute.charset
- theCharset
to use for byte to string conversion.- Returns:
- A
CompletableFuture
that will provide theFields
or a failure.
-
from
@Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<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 aFormFields
from aContent.Source
.- Parameters:
request
- TheRequest
in which to look for an existingFormFields
attribute, using the classname as the attribute name, else the request is used as aContent.Source
from which to read the fields and set the attribute.maxFields
- The maximum number of fields to be parsedmaxLength
- The maximum total size of the fields- Returns:
- A
CompletableFuture
that will provide theFields
or a failure.
-
from
@Deprecated(forRemoval=true, since="12.0.15") public static CompletableFuture<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 aFormFields
from aContent.Source
.- Parameters:
request
- TheRequest
in which to look for an existingFormFields
attribute, using the classname as the attribute name, else the request is used as aContent.Source
from which to read the fields and set the attribute.charset
- theCharset
to use for byte to string conversion.maxFields
- The maximum number of fields to be parsedmaxLength
- The maximum total size of the fields- Returns:
- A
CompletableFuture
that will provide theFields
or a failure.
-
parse
Description copied from class:ContentSourceCompletableFuture
Called by
ContentSourceCompletableFuture.parse()
to parse aContent.Chunk
.- Specified by:
parse
in classContentSourceCompletableFuture<Fields>
- Parameters:
chunk
- The chunk containing content to parse. The chunk will never benull
nor afailure chunk
. If the chunk is stored away to be used later beyond the scope of this call, then implementations must callRetainable.retain()
andRetainable.release()
as appropriate.- Returns:
- The parsed
X
result instance ornull
if parsing is not yet complete - Throws:
CharacterCodingException
-