According to RFC 7231, POST, PUT and OPTIONS allow to have a body. This encoder will support widely all methods except TRACE since the RFC notes for GET, DELETE, HEAD and CONNECT: (replaces XXX by one of these methods)
"A payload within a XXX request message has no defined semantics; sending a payload body on a XXX request might cause some existing implementations to reject the request."
On the contrary, for TRACE method, RFC says:
"A client MUST NOT send a message body in a TRACE request."
| Modifier and Type | Class and Description |
|---|---|
| public static enum | HttpPostRequestEncoder.EncoderMode
Different modes to use to encode form data. |
| public static class | HttpPostRequestEncoder.ErrorDataEncoderException
Exception when an error occurs while encoding |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final List | bodyListDatas
InterfaceHttpData for Body (without encoding) |
| private final Charset | charset
Default charset to use |
| private Buffer | currentBuffer
The ByteBuf currently used by the encoder |
| private InterfaceHttpData | currentData
The current InterfaceHttpData to encode (used if more chunks are available) |
| private FileUpload | currentFileUpload
The current FileUpload that is currently in encode process |
| private boolean | duringMixedMode
While adding a FileUpload, is the multipart currently in Mixed Mode |
| private final HttpPostRequestEncoder. | |
| private final HttpDataFactory | factory
Factory used to create InterfaceHttpData |
| private long | globalBodySize
Global Body size |
| private long | globalProgress
Global Transfer progress |
| private boolean | headerFinalized
To check if the header has been finalized |
| private boolean | isChunked
Chunked false by default |
| private boolean | isKey
If not multipart, does the currentBuffer stands for the Key or for the Value |
| private boolean | isLastChunk
Does the last non empty chunk already encoded so that next chunk will be empty (last chunk) |
| private boolean | isLastChunkSent
Last chunk already sent |
| private final boolean | isMultipart
Does this request is a Multipart request |
| private ListIterator | iterator
Iterator to be used when encoding will be called chunk after chunk |
| pack-priv String | multipartDataBoundary
If multipart, this is the boundary for the flobal multipart |
| pack-priv final List | multipartHttpDatas
The final Multipart List of InterfaceHttpData including encoding |
| pack-priv String | multipartMixedBoundary
If multipart, there could be internal multiparts (mixed) to the global multipart. |
| private static final Map. | |
| private final HttpRequest | request
Request to encode |
| Access | Constructor and Description |
|---|---|
| public | HttpPostRequestEncoder(HttpRequest
the request to encode request, boolean True if the FORM is a ENCTYPE="multipart/form-data" multipart)
|
| public | HttpPostRequestEncoder(HttpDataFactory
the factory used to create InterfaceHttpData factory, HttpRequest the request to encode request, boolean True if the FORM is a ENCTYPE="multipart/form-data" multipart)
|
| public | HttpPostRequestEncoder(HttpDataFactory
the factory used to create InterfaceHttpData factory, HttpRequest the request to encode request, boolean True if the FORM is a ENCTYPE="multipart/form-data" multipart, Charset the charset to use as default charset, HttpPostRequestEncoder.the mode for the encoder to use. See encoderModeEncoderMode for the details.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | addBodyAttribute(String
name of the parameter name, String the value of the parameter value)Add a simple attribute in the body as Name=Value |
| public void | addBodyFileUpload(String
the name of the parameter name, File the file to be uploaded (if not Multipart mode, only the filename will be included) file, String the associated contentType for the File contentType, boolean True if this file should be transmitted in Text format (else binary) isText)Add a file as a FileUpload |
| public void | addBodyFileUpload(String
the name of the parameter name, String the filename to use for this File part, empty String will be ignored by
the encoder filename, File the file to be uploaded (if not Multipart mode, only the filename will be included) file, String the associated contentType for the File contentType, boolean True if this file should be transmitted in Text format (else binary) isText)Add a file as a FileUpload |
| public void | addBodyFileUploads(String
the name of the parameter name, File[] the array of files file, String[] the array of content Types associated with each file contentType, boolean[] the array of isText attribute (False meaning binary mode) for each file isText)Add a series of Files associated with one File parameter |
| public void | |
| private int | |
| public void | |
| public void | close()
Implements java. |
| private String | |
| private HttpContent | Returns: the next HttpChunk or null if not enough bytes were foundthe number of bytes to try to get from currentData sizeleft)From the current context (currentBuffer and currentData), returns the next HttpChunk (if possible) trying to get sizeleft bytes more into the currentBuffer. |
| private HttpContent | Returns: the next HttpChunk or null if not enough bytes were foundthe number of bytes to try to get from currentData sizeleft)From the current context (currentBuffer and currentData), returns the next HttpChunk (if possible) trying to get sizeleft bytes more into the currentBuffer. |
| private Buffer | Returns: the next ByteBuf to send as an HttpChunk and modifying currentBuffer accordingly
|
| public HttpRequest | Returns: the request object (chunked or not according to size of body)Finalize the request by preparing the Header in the request and returns the request ready to be sent. |
| public List | Returns: the list of InterfaceHttpData from Body partThis getMethod returns a List of all InterfaceHttpData from body part. |
| private static String | |
| private void | |
| private void | |
| public boolean | |
| public boolean | isEndOfInput()
Implements io. true if and only if there is no data left in the stream
and the stream has reached at its end.
|
| public boolean | Returns: True if this request is a Multipart requestTrue if this request is a Multipart request |
| private HttpContent | |
| public long | |
| private HttpContent | |
| public long | progress()
Implements io. |
| public HttpContent | Returns: the next available HttpChunkBufferAllocator if buffer allocation is necessary.Implements io. |
| public void |