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 CompletableFuture
CompletableFuture.AsynchronousCompletionTaskNested classes/interfaces inherited from interface Future
Future.StateNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface Invocable.Task
Invocable.Task.Abstract -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final Stringstatic final intFields inherited from interface 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.useonFields(Request, Charset, Promise.Invocable)instead.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.usegetFields(Request)instead.static FieldsGet the Fields from a request.static FieldsGet the Fields from a request.static CharsetgetFormEncodedCharset(Request request) static voidonFields(Request request, Charset charset, int maxFields, int maxLength, Promise.Invocable<Fields> promise) Asynchronously reads and parsesFormFieldsfrom aRequest.static voidonFields(Request request, Charset charset, Promise.Invocable<Fields> promise) Asynchronously read and parse FormFields from aRequest.static voidonFields(Request request, Promise.Invocable<Fields> promise) Asynchronously read and parse FormFields from aRequest.protected Fieldsparse(Content.Chunk chunk) Called byContentSourceCompletableFuture.parse()to parse aContent.Chunk.static voidset(Request request, CompletableFuture<Fields> fields) Deprecated, for removal: This API element is subject to removal in a future version.do not use it, no replacement.static voidSet aFieldsor related failure for the requestMethods inherited from class ContentSourceCompletableFuture
acceptEither, applyToEither, get, get, getInvocationType, handle, join, onTransientFailure, parse, run, runAfterBoth, runAfterEither, thenAccept, thenAcceptBoth, thenApply, thenCombine, thenCompose, thenRun, whenCompleteMethods inherited from class 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, exceptionNow, failedFuture, failedStage, getNow, getNumberOfDependents, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, resultNow, runAfterBothAsync, runAfterBothAsync, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, state, 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.do not use it, no replacement.Set aFieldsor related failure for the request- Parameters:
request- The request to which to associate the fields withfields- ACompletableFuturethat will provide either the fields or a failure.
-
setFields
Set aFieldsor related failure for the request- Parameters:
request- The request to which to associate the fields withfields- ACompletableFuturethat 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
onFieldsandgetFieldsmethods 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
onFieldsandgetFieldsmethods 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 accept or -1 for unlimitedmaxLength- The maximum length of fields or -1 for unlimited.- Returns:
- the Fields
- See Also:
-
onFields
Asynchronously read and parse FormFields from aRequest.Calls to
onFieldsandgetFieldsmethods 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 theFormFieldsare available.- See Also:
-
onFields
Asynchronously read and parse FormFields from aRequest.Calls to
onFieldsandgetFieldsmethods 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- TheCharsetof 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, Promise.Invocable<Fields> promise) Asynchronously reads and parses
FormFieldsfrom aRequest.Calls to
onFieldsandgetFieldsmethods 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- TheCharsetof the request content, if previously extracted.maxFields- The maximum number of fields to accept or -1 for unlimitedmaxLength- The maximum length of fields or -1 for unlimitedpromise- The action to take when the FormFields are available.
-
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.usegetFields(Request)instead.- Parameters:
request- The request to enquire from- Returns:
- A
CompletableFuturethat 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.useonFields(Request, Promise.Invocable)instead.Find or create aFormFieldsfrom aContent.Source.- Parameters:
request- TheRequestin which to look for an existingFormFieldsattribute, using the classname as the attribute name, else the request is used as aContent.Sourcefrom which to read the fields and set the attribute.- Returns:
- A
CompletableFuturethat will provide theFieldsor 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.useonFields(Request, Charset, Promise.Invocable)instead.Find or create aFormFieldsfrom aContent.Source.- Parameters:
request- TheRequestin which to look for an existingFormFieldsattribute, using the classname as the attribute name, else the request is used as aContent.Sourcefrom which to read the fields and set the attribute.charset- theCharsetto use for byte to string conversion.- Returns:
- A
CompletableFuturethat will provide theFieldsor 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 aFormFieldsfrom aContent.Source.- Parameters:
request- TheRequestin which to look for an existingFormFieldsattribute, using the classname as the attribute name, else the request is used as aContent.Sourcefrom which to read the fields and set the attribute.maxFields- The maximum number of fields to be parsed or -1 for unlimitedmaxLength- The maximum total size of the fields or -1 for unlimited- Returns:
- A
CompletableFuturethat will provide theFieldsor 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 aFormFieldsfrom aContent.Source.- Parameters:
request- TheRequestin which to look for an existingFormFieldsattribute, using the classname as the attribute name, else the request is used as aContent.Sourcefrom which to read the fields and set the attribute.charset- theCharsetto use for byte to string conversion.maxFields- The maximum number of fields to be parsed or -1 for unlimitedmaxLength- The maximum total size of the fields or -1 for unlimited- Returns:
- A
CompletableFuturethat will provide theFieldsor a failure.
-
parse
Description copied from class:ContentSourceCompletableFutureCalled by
ContentSourceCompletableFuture.parse()to parse aContent.Chunk.- Specified by:
parsein classContentSourceCompletableFuture<Fields>- Parameters:
chunk- The chunk containing content to parse. The chunk will never benullnor 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
Xresult instance ornullif parsing is not yet complete - Throws:
CharacterCodingException
-
onFields(Request, Promise.Invocable)instead.