Top Description Fields Constructors Methods
org.eclipse.jetty.server

public Class FormFields

extends ContentSourceCompletableFuture<Fields>
Class Inheritance
Imports
java.nio.ByteBuffer, java.nio.charset.CharacterCodingException, .Charset, .StandardCharsets, java.util.concurrent.CompletableFuture, org.eclipse.jetty.http.HttpHeader, .MimeTypes, org.eclipse.jetty.io.Content, org.eclipse.jetty.io.content.ContentSourceCompletableFuture, org.eclipse.jetty.util.Attributes, .BufferUtil, .CharsetStringBuilder, .Fields, .StringUtil

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

Specification.

Field Summary

Modifier and TypeField and Description
private final CharsetStringBuilder
private final Fields
private int
private final int
private final int
private String
private int
private byte
private static final CompletableFuture<Fields>
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
private
FormFields(Content.Source source, Charset charset, int maxFields, int maxSize)

Method Summary

Modifier and TypeMethod and Description
private void
checkMaxLength(String nameOrValue)

public static CompletableFuture<Fields>

Returns:

A CompletableFuture that will provide the Fields or a failure.
from
(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.
request
)

Find or create a FormFields from a Content.Source.

public static CompletableFuture<Fields>

Returns:

A CompletableFuture that will provide the Fields or a failure.
from
(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.
request
,
Charset
the Charset to use for byte to string conversion.
charset
)

Find or create a FormFields from a Content.Source.

public static CompletableFuture<Fields>

Returns:

A CompletableFuture that will provide the Fields or a failure.
from
(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.
request
,
int
The maximum number of fields to be parsed
maxFields
,
int
The maximum total size of the fields
maxLength
)

Find or create a FormFields from a Content.Source.

public static CompletableFuture<Fields>

Returns:

A CompletableFuture that will provide the Fields or a failure.
from
(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.
request
,
Charset
the Charset to use for byte to string conversion.
charset
,
int
The maximum number of fields to be parsed
maxFields
,
int
The maximum total size of the fields
maxLength
)

Find or create a FormFields from a Content.Source.

pack-priv static CompletableFuture<Fields>

Returns:

A CompletableFuture that will provide the Fields or a failure.
from
(Content.Source
The Content.Source from which to read the fields.
source
,
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.
attributes
,
Charset
the Charset to use for byte to string conversion.
charset
,
int
The maximum number of fields to be parsed
maxFields
,
int
The maximum total size of the fields
maxLength
)

Find or create a FormFields from a Content.Source.

public static CompletableFuture<Fields>
get(Request
The request to enquire from
request
)

Returns: A CompletableFuture that will provide either the fields or a failure, or null if none set.

public static Charset
private static int
getRequestAttribute(Request request, String attribute)

private void
onNewField(String name, String value)

protected Fields
parse(Content.Chunk
The chunk containing content to parse. The chunk will never be null nor a failure chunk. If the chunk is stored away to be used later beyond the scope of this call, then implementations must call Content.Chunk#retain() and Content.Chunk#release() as appropriate.
chunk
)

Implements abstract org.eclipse.jetty.io.content.ContentSourceCompletableFuture.parse.

Called by parse() to parse a org.eclipse.jetty.io.Content.Chunk.

public static void
set(Request
The request to which to associate the fields with
request
,
CompletableFuture<Fields>
A CompletableFuture that will provide either the fields or a failure.
fields
)

Set a Fields or related failure for the request

Inherited from org.eclipse.jetty.io.content.ContentSourceCompletableFuture:
onTransientFailureparse

Field Detail

_builderback to summary
private final CharsetStringBuilder _builder
_fieldsback to summary
private final Fields _fields
_lengthback to summary
private int _length
_maxFieldsback to summary
private final int _maxFields
_maxLengthback to summary
private final int _maxLength
_nameback to summary
private String _name
_percentback to summary
private int _percent
_percentCodeback to summary
private byte _percentCode
EMPTYback to summary
private static final CompletableFuture<Fields> EMPTY
MAX_FIELDS_ATTRIBUTEback to summary
public static final String MAX_FIELDS_ATTRIBUTE
MAX_LENGTH_ATTRIBUTEback to summary
public static final String MAX_LENGTH_ATTRIBUTE

Constructor Detail

FormFieldsback to summary
private FormFields(Content.Source source, Charset charset, int maxFields, int maxSize)

Method Detail

checkMaxLengthback to summary
private void checkMaxLength(String nameOrValue)
fromback to summary
public static CompletableFuture<Fields> from(Request request)

Find or create a FormFields from a Content.Source.

Parameters
request: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:CompletableFuture<Fields>

A CompletableFuture that will provide the Fields or a failure.

See Also
from(Content.Source, Attributes, Charset, int, int)
fromback to summary
public static CompletableFuture<Fields> from(Request request, Charset charset)

Find or create a FormFields from a Content.Source.

Parameters
request: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:Charset

the Charset to use for byte to string conversion.

Returns:CompletableFuture<Fields>

A CompletableFuture that will provide the Fields or a failure.

See Also
from(Content.Source, Attributes, Charset, int, int)
fromback to summary
public static CompletableFuture<Fields> from(Request request, int maxFields, int maxLength)

Find or create a FormFields from a Content.Source.

Parameters
request: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:int

The maximum number of fields to be parsed

maxLength:int

The maximum total size of the fields

Returns:CompletableFuture<Fields>

A CompletableFuture that will provide the Fields or a failure.

See Also
from(Content.Source, Attributes, Charset, int, int)
fromback to summary
public static CompletableFuture<Fields> from(Request request, Charset charset, int maxFields, int maxLength)

Find or create a FormFields from a Content.Source.

Parameters
request: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:Charset

the Charset to use for byte to string conversion.

maxFields:int

The maximum number of fields to be parsed

maxLength:int

The maximum total size of the fields

Returns:CompletableFuture<Fields>

A CompletableFuture that will provide the Fields or a failure.

See Also
from(Content.Source, Attributes, Charset, int, int)
fromback to summary
pack-priv static CompletableFuture<Fields> from(Content.Source source, Attributes attributes, Charset charset, int maxFields, int maxLength)

Find or create a FormFields from a Content.Source.

Parameters
source:Content.Source

The Content.Source from which to read the fields.

attributes: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:Charset

the Charset to use for byte to string conversion.

maxFields:int

The maximum number of fields to be parsed

maxLength:int

The maximum total size of the fields

Returns:CompletableFuture<Fields>

A CompletableFuture that will provide the Fields or a failure.

getback to summary
public static CompletableFuture<Fields> get(Request request)
Parameters
request:Request

The request to enquire from

Returns:CompletableFuture<Fields>

A CompletableFuture that will provide either the fields or a failure, or null if none set.

See Also
from(Request)
getFormEncodedCharsetback to summary
public static Charset getFormEncodedCharset(Request request)
getRequestAttributeback to summary
private static int getRequestAttribute(Request request, String attribute)
onNewFieldback to summary
private void onNewField(String name, String value)
parseback to summary
protected Fields parse(Content.Chunk chunk) throws CharacterCodingException

Implements abstract org.eclipse.jetty.io.content.ContentSourceCompletableFuture.parse.

Doc from org.eclipse.jetty.io.content.ContentSourceCompletableFuture.parse.

Called by parse() to parse a org.eclipse.jetty.io.Content.Chunk.

Parameters
chunk:Content.Chunk

The chunk containing content to parse. The chunk will never be null nor a failure chunk. If the chunk is stored away to be used later beyond the scope of this call, then implementations must call Content.Chunk#retain() and Content.Chunk#release() as appropriate.

Returns:Fields

The parsed X result instance or null if parsing is not yet complete

Annotations
@Override
setback to summary
public static void set(Request request, CompletableFuture<Fields> fields)

Set a Fields or related failure for the request

Parameters
request:Request

The request to which to associate the fields with

fields:CompletableFuture<Fields>

A CompletableFuture that will provide either the fields or a failure.