io.undertow.server.handlers.form

## Interface FormDataParser

All Superinterfaces:
  AutoCloseable, Closeable

    public interface FormDataParser
    extends Closeable

Parser for form data. This can be used by down-stream handlers to parse form data.

This parser must be closed to make sure any temporary files have been cleaned up.

Author:
  Stuart Douglas

### Field Summary

Fields
`static AttachmentKey<FormData>` `FORM_DATA` When the form data is parsed it will be attached under this key.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `close()` Closes the parser, and removes and temporary files that may have been created.
`void` `parse(HttpHandler next)` Parse the form data asynchronously.
`FormData` `parseBlocking()` Parse the data, blocking the current thread until parsing is complete.
`void` `setCharacterEncoding(String encoding)` Sets the character encoding that will be used by this parser.

### Field Detail

#### FORM_DATA

    static final AttachmentKey<FormData> FORM_DATA

When the form data is parsed it will be attached under this key.

### Method Detail

#### parse

    void parse(HttpHandler next)
        throws Exception

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.

Throws:
  `Exception`

#### parseBlocking

    FormData parseBlocking()
                    throws IOException

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:
  The parsed form data
Throws:
  `IOException` - If the data could not be read

#### close

    void close()
        throws IOException

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

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Throws:
  `IOException`

#### setCharacterEncoding

    void setCharacterEncoding(String encoding)

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

Parameters:
  `encoding` - The encoding