Top Description Inners Fields Constructors Methods
io.undertow.server.handlers.form

public Class FormEncodedDataDefinition

extends Object
implements FormParserFactory.ParserDefinition<FormEncodedDataDefinition>
Class Inheritance
All Implemented Interfaces
io.undertow.server.handlers.form.FormParserFactory.ParserDefinition
Imports
io.undertow.UndertowLogger, .UndertowMessages, .UndertowOptions, io.undertow.connector.PooledByteBuffer, io.undertow.server.HttpHandler, .HttpServerExchange, io.undertow.util.UrlDecodeException, .Headers, .SameThreadExecutor, .URLUtils, org.xnio.ChannelListener, .IoUtils, org.xnio.channels.StreamSourceChannel, java.io.IOException, java.nio.ByteBuffer

Parser definition for form encoded data. This handler takes effect for any request that has a mime type of application/x-www-form-urlencoded. The handler attaches a FormDataParser to the chain that can parse the underlying form data asynchronously.
Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final String
private String
private boolean
private static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public FormDataParser
public String
public boolean
public FormEncodedDataDefinition
public FormEncodedDataDefinition
setForceCreation(boolean forceCreation)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

APPLICATION_X_WWW_FORM_URLENCODEDback to summary
public static final String APPLICATION_X_WWW_FORM_URLENCODED
defaultEncodingback to summary
private String defaultEncoding
forceCreationback to summary
private boolean forceCreation
parseExceptionLogAsDebugback to summary
private static boolean parseExceptionLogAsDebug

Constructor Detail

FormEncodedDataDefinitionback to summary
public FormEncodedDataDefinition()

Method Detail

createback to summary
public FormDataParser create(final HttpServerExchange exchange)

Implements io.undertow.server.handlers.form.FormParserFactory.ParserDefinition.create.

Annotations
@Override
getDefaultEncodingback to summary
public String getDefaultEncoding()
isForceCreationback to summary
public boolean isForceCreation()
setDefaultEncodingback to summary
public FormEncodedDataDefinition setDefaultEncoding(final String defaultEncoding)

Implements io.undertow.server.handlers.form.FormParserFactory.ParserDefinition.setDefaultEncoding.

setForceCreationback to summary
public FormEncodedDataDefinition setForceCreation(boolean forceCreation)
io.undertow.server.handlers.form back to summary

private final Class FormEncodedDataDefinition.FormEncodedDataParser

extends Object
implements ChannelListener<StreamSourceChannel>, FormDataParser
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.form.FormEncodedDataDefinition.FormEncodedDataParser
All Implemented Interfaces
io.undertow.server.handlers.form.FormDataParser, java.io.Closeable, java.lang.AutoCloseable, org.xnio.ChannelListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private final StringBuilder
private String
private final FormData
private final HttpServerExchange
private HttpHandler
private String
private int

Constructor Summary

AccessConstructor and Description
private
FormEncodedDataParser(final String charset, final HttpServerExchange exchange)

Method Summary

Modifier and TypeMethod and Description
private void
addPair(String name, String value)

public void
close()

Implements io.undertow.server.handlers.form.FormDataParser.close.

Closes the parser, and removes and temporary files that may have been created.

private String
decodeParameterName(String name, String charset, boolean decodeSlash, StringBuilder stringBuilder)

private String
decodeParameterValue(String name, String value, String charset, boolean decodeSlash, StringBuilder stringBuilder)

private void
public void
handleEvent(final StreamSourceChannel
the channel event
channel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

public void
parse(HttpHandler handler)

Implements io.undertow.server.handlers.form.FormDataParser.parse.

Parse the form data asynchronously.

public FormData
parseBlocking()

Implements io.undertow.server.handlers.form.FormDataParser.parseBlocking.

Parse the data, blocking the current thread until parsing is complete.

public void
setCharacterEncoding(final String
The encoding
encoding
)

Implements io.undertow.server.handlers.form.FormDataParser.setCharacterEncoding.

Sets the character encoding that will be used by this parser.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
private final StringBuilder builder
charsetback to summary
private String charset
databack to summary
private final FormData data
exchangeback to summary
private final HttpServerExchange exchange
handlerback to summary
private HttpHandler handler
nameback to summary
private String name
stateback to summary
private int state

Constructor Detail

FormEncodedDataParserback to summary
private FormEncodedDataParser(final String charset, final HttpServerExchange exchange)

Method Detail

addPairback to summary
private void addPair(String name, String value)
closeback to summary
public void close() throws IOException

Implements io.undertow.server.handlers.form.FormDataParser.close.

Doc from io.undertow.server.handlers.form.FormDataParser.close.

Closes the parser, and removes and temporary files that may have been created.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Closeable.close.

if an I/O error occurs

decodeParameterNameback to summary
private String decodeParameterName(String name, String charset, boolean decodeSlash, StringBuilder stringBuilder)
decodeParameterValueback to summary
private String decodeParameterValue(String name, String value, String charset, boolean decodeSlash, StringBuilder stringBuilder)
doParseback to summary
private void doParse(final StreamSourceChannel channel) throws IOException
handleEventback to summary
public void handleEvent(final StreamSourceChannel channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:StreamSourceChannel

the channel event

Annotations
@Override
parseback to summary
public void parse(HttpHandler handler) throws Exception

Implements io.undertow.server.handlers.form.FormDataParser.parse.

Doc from io.undertow.server.handlers.form.FormDataParser.parse.

Parse the form data asynchronously. If all the data cannot be read immediately then a read listener will be registered, and the data will be parsed by the read thread.

When this method completes the handler will be invoked, and the data will be attached under FORM_DATA.

The method can either invoke the next handler directly, or may delegate to the IO thread to perform the parsing.

Annotations
@Override
parseBlockingback to summary
public FormData parseBlocking() throws IOException

Implements io.undertow.server.handlers.form.FormDataParser.parseBlocking.

Doc from io.undertow.server.handlers.form.FormDataParser.parseBlocking.

Parse the data, blocking the current thread until parsing is complete. For blocking handlers this method is more efficient than parse(io.undertow.server.HttpHandler next), as the calling thread should do that actual parsing, rather than the read thread

Returns:FormData

The parsed form data

Annotations
@Override
Exceptions
IOException:
If the data could not be read
setCharacterEncodingback to summary
public void setCharacterEncoding(final String encoding)

Implements io.undertow.server.handlers.form.FormDataParser.setCharacterEncoding.

Doc from io.undertow.server.handlers.form.FormDataParser.setCharacterEncoding.

Sets the character encoding that will be used by this parser. If the request is already processed this will have no effect

Parameters
encoding:String

The encoding

Annotations
@Override