destroy() after completion to release all resources.
| Modifier and Type | Field and Description |
|---|---|
| private final List | bodyListHttpData
HttpDatas from Body |
| private int | bodyListHttpDataRank
Body HttpDatas current position |
| private final Map | bodyMapHttpData
HttpDatas as Map from Body |
| private Charset | charset
Default charset to use |
| private Attribute | currentAttribute
The current Attribute that is currently in decode process |
| private Map | currentFieldAttributes
Used in Multipart |
| private FileUpload | currentFileUpload
The current FileUpload that is currently in decode process |
| private HttpPostRequestDecoder. | currentStatus
Current getStatus |
| private boolean | |
| private int | |
| private final HttpDataFactory | factory
Factory used to create InterfaceHttpData |
| private static final String | |
| private boolean | isLastChunk
Does the last chunk already received |
| private final String | multipartDataBoundary
If multipart, this is the boundary for the global multipart |
| private String | multipartMixedBoundary
If multipart, there could be internal multiparts (mixed) to the global multipart. |
| private final HttpRequest | request
Request to decode |
| private ByteBuf | undecodedChunk
The current channelBuffer |
| Access | Constructor and Description |
|---|---|
| public | |
| public | HttpPostMultipartRequestDecoder(HttpDataFactory
the factory used to create InterfaceHttpData factory, HttpRequest the request to decode request)
|
| public | HttpPostMultipartRequestDecoder(HttpDataFactory
the factory used to create InterfaceHttpData factory, HttpRequest the request to decode request, Charset the charset to use as default charset)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| private void | |
| public void | cleanFiles()
Implements io. |
| private void | cleanMixedAttributes()
Remove all Attributes that should be cleaned between two FileUpload in Mixed mode |
| private static String | |
| public InterfaceHttpData | currentPartialHttpData()
Implements io. |
| private InterfaceHttpData | Returns: the next decoded InterfaceHttpData or null if none until now.Decode a multipart request by pieces NOTSTARTED PREAMBLE ( (HEADERDELIMITER DISPOSITION (FIELD | FILEUPLOAD))* (HEADERDELIMITER DISPOSITION MIXEDPREAMBLE (MIXEDDELIMITER MIXEDDISPOSITION MIXEDFILEUPLOAD)+ MIXEDCLOSEDELIMITER)* CLOSEDELIMITER)+ EPILOGUE Inspired from HttpMessageDecoder |
| public void | destroy()
Implements io. HttpPostMultipartRequestDecoder and release all it resources.
|
| private InterfaceHttpData | Returns: the next InterfaceHttpData if anydelimiter to find delimiter, HttpPostRequestDecoder.the next getStatus if the delimiter is a start dispositionStatus,the next getStatus if the delimiter is a close delimiter closeDelimiterStatusFind the next Multipart Delimiter |
| private InterfaceHttpData | |
| public InterfaceHttpData | Returns: The first Body InterfaceHttpData with the given name (ignore case)Implements io. |
| public List | Returns: the list of HttpDatas from Body part for POST getMethodImplements io. |
| public List | Returns: All Body HttpDatas with the given name (ignore case)Implements io. |
| private Attribute | |
| pack-priv int | Returns: the number of bytes the internal buffer can containThis method is package private intentionally in order to allow during tests to access to the amount of memory allocated (capacity) within the private ByteBuf undecodedChunk |
| public int | getDiscardThreshold()
Implements io. |
| protected InterfaceHttpData | Returns: the InterfaceHttpData if anythe delimiter to use delimiter)Get the FileUpload (new one or current one) |
| public boolean | Returns: True if at current getStatus, there is a decoded InterfaceHttpDataImplements io. |
| public boolean | Returns: True if this request is a Multipart requestImplements io. |
| private static boolean | Returns: true if the last chunk is loaded (boundary delimiter found), false if need more chunksLoad the field value or file data from a Multipart request |
| public InterfaceHttpData | Returns: the next available InterfaceHttpData or null if noneImplements io. |
| public HttpPostMultipartRequestDecoder | offer(HttpContent
the new received chunk content)Implements io. |
| private void | |
| private void | |
| private static String | Returns: the String from one line as the delimiter searched (opening or closing)of the form --string, such that '--' is already included delimiter, Charset charset)Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF. |
| private static String | Returns: the String from one lineRead one line up to the CRLF or LF |
| public void | removeHttpDataFromClean(InterfaceHttpData data)
Implements io. |
| private static void | rewriteCurrentBuffer(ByteBuf
the buffer to rewrite from current readerIndex buffer, int the size to skip from readerIndex lengthToSkip)Rewrite buffer in order to skip lengthToSkip bytes from current readerIndex, such that any readable bytes available after readerIndex + lengthToSkip (so before writerIndex) are moved at readerIndex position, therefore decreasing writerIndex of lengthToSkip at the end of the process. |
| public void | setDiscardThreshold(int discardThreshold)
Implements io. |
| private static void | |
| private static void | |
| private boolean | |
| private static String[] | Returns: an array of String where rank 0 is the name of the header, follows by several values that were separated by ';' or ','Split one header in Multipart |
| private static String[] | Returns: an array of String where values that were separated by ';' or ','Split one header value in Multipart |
| bodyListHttpData | back to summary |
|---|---|
| private final List<InterfaceHttpData> bodyListHttpData HttpDatas from Body | |
| bodyListHttpDataRank | back to summary |
|---|---|
| private int bodyListHttpDataRank Body HttpDatas current position | |
| bodyMapHttpData | back to summary |
|---|---|
| private final Map<String, List<InterfaceHttpData>> bodyMapHttpData HttpDatas as Map from Body | |
| charset | back to summary |
|---|---|
| private Charset charset Default charset to use | |
| currentAttribute | back to summary |
|---|---|
| private Attribute currentAttribute The current Attribute that is currently in decode process | |
| currentFieldAttributes | back to summary |
|---|---|
| private Map<CharSequence, Attribute> currentFieldAttributes Used in Multipart | |
| currentFileUpload | back to summary |
|---|---|
| private FileUpload currentFileUpload The current FileUpload that is currently in decode process | |
| currentStatus | back to summary |
|---|---|
| private HttpPostRequestDecoder. Current getStatus | |
| destroyed | back to summary |
|---|---|
| private boolean destroyed | |
| discardThreshold | back to summary |
|---|---|
| private int discardThreshold | |
| factory | back to summary |
|---|---|
| private final HttpDataFactory factory Factory used to create InterfaceHttpData | |
| FILENAME_ENCODED | back to summary |
|---|---|
| private static final String FILENAME_ENCODED | |
| isLastChunk | back to summary |
|---|---|
| private boolean isLastChunk Does the last chunk already received | |
| multipartDataBoundary | back to summary |
|---|---|
| private final String multipartDataBoundary If multipart, this is the boundary for the global multipart | |
| multipartMixedBoundary | back to summary |
|---|---|
| private String multipartMixedBoundary If multipart, there could be internal multiparts (mixed) to the global multipart. Only one level is allowed. | |
| request | back to summary |
|---|---|
| private final HttpRequest request Request to decode | |
| undecodedChunk | back to summary |
|---|---|
| private ByteBuf undecodedChunk The current channelBuffer | |
| HttpPostMultipartRequestDecoder | back to summary |
|---|---|
public HttpPostMultipartRequestDecoder(HttpRequest request)
| |
| HttpPostMultipartRequestDecoder | back to summary |
|---|---|
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request)
| |
| HttpPostMultipartRequestDecoder | back to summary |
|---|---|
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset)
| |
| addHttpData | back to summary |
|---|---|
| protected void addHttpData(InterfaceHttpData data) Utility function to add a new decoded data | |
| checkDestroyed | back to summary |
|---|---|
| private void checkDestroyed() | |
| cleanFiles | back to summary |
|---|---|
| public void cleanFiles() Implements io. Clean all HttpDatas (on Disk) for the current request.
| |
| cleanMixedAttributes | back to summary |
|---|---|
| private void cleanMixedAttributes() Remove all Attributes that should be cleaned between two FileUpload in Mixed mode | |
| cleanString | back to summary |
|---|---|
| private static String cleanString(String field) Clean the String from any unallowed character
| |
| currentPartialHttpData | back to summary |
|---|---|
| public InterfaceHttpData currentPartialHttpData() Implements io. Doc from io. Returns the current InterfaceHttpData if currently in decoding status, meaning all data are not yet within, or null if there is no InterfaceHttpData currently in decoding status (either because none yet decoded or none currently partially decoded). Full decoded ones are accessible through hasNext() and next() methods.
| |
| decodeMultipart | back to summary |
|---|---|
| private InterfaceHttpData decodeMultipart(HttpPostRequestDecoder. Decode a multipart request by pieces
| |
| destroy | back to summary |
|---|---|
| public void destroy() Implements io. Destroy the
| |
| findMultipartDelimiter | back to summary |
|---|---|
| private InterfaceHttpData findMultipartDelimiter(String delimiter, HttpPostRequestDecoder. Find the next Multipart Delimiter
| |
| findMultipartDisposition | back to summary |
|---|---|
| private InterfaceHttpData findMultipartDisposition() Find the next Disposition
| |
| getBodyHttpData | back to summary |
|---|---|
| public InterfaceHttpData getBodyHttpData(String name) Implements io. This getMethod returns the first InterfaceHttpData with the given name from
body.
| |
| getBodyHttpDatas | back to summary |
|---|---|
| public List Implements io. This getMethod returns a List of all HttpDatas from body.
| |
| getBodyHttpDatas | back to summary |
|---|---|
| public List Implements io. This getMethod returns a List of all HttpDatas with the given name from
body.
| |
| getContentDispositionAttribute | back to summary |
|---|---|
| private Attribute getContentDispositionAttribute(String... values) | |
| getCurrentAllocatedCapacity | back to summary |
|---|---|
| pack-priv int getCurrentAllocatedCapacity() This method is package private intentionally in order to allow during tests to access to the amount of memory allocated (capacity) within the private ByteBuf undecodedChunk
| |
| getDiscardThreshold | back to summary |
|---|---|
| public int getDiscardThreshold() Implements io. Return the threshold in bytes after which read data in the buffer should be discarded.
| |
| getFileUpload | back to summary |
|---|---|
| protected InterfaceHttpData getFileUpload(String delimiter) Get the FileUpload (new one or current one)
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements io. True if at current getStatus, there is an available decoded InterfaceHttpData from the Body. This getMethod works for chunked and not chunked request.
| |
| isMultipart | back to summary |
|---|---|
| public boolean isMultipart() Implements io. True if this request is a Multipart request
| |
| loadDataMultipartOptimized | back to summary |
|---|---|
| private static boolean loadDataMultipartOptimized(ByteBuf undecodedChunk, String delimiter, HttpData httpData) Load the field value or file data from a Multipart request
| |
| next | back to summary |
|---|---|
| public InterfaceHttpData next() Implements io. Returns the next available InterfaceHttpData or null if, at the time it
is called, there is no more available InterfaceHttpData. A subsequent
call to offer(httpChunk) could enable more data.
Be sure to call
| |
| offer | back to summary |
|---|---|
| public HttpPostMultipartRequestDecoder offer(HttpContent content) Implements io. Initialized the internals from a new chunk
| |
| parseBody | back to summary |
|---|---|
| private void parseBody() This getMethod will parse as much as possible data and fill the list and map
| |
| parseBodyMultipart | back to summary |
|---|---|
| private void parseBodyMultipart() Parse the Body for multipart
| |
| readDelimiterOptimized | back to summary |
|---|---|
| private static String readDelimiterOptimized(ByteBuf undecodedChunk, String delimiter, Charset charset) Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF. Note that CRLF or LF are mandatory for opening delimiter (--delimiter) but not for closing delimiter (--delimiter--) since some clients does not include CRLF in this case.
| |
| readLineOptimized | back to summary |
|---|---|
| private static String readLineOptimized(ByteBuf undecodedChunk, Charset charset) Read one line up to the CRLF or LF
| |
| removeHttpDataFromClean | back to summary |
|---|---|
| public void removeHttpDataFromClean(InterfaceHttpData data) Implements io. Remove the given FileUpload from the list of FileUploads to clean
| |
| rewriteCurrentBuffer | back to summary |
|---|---|
| private static void rewriteCurrentBuffer(ByteBuf buffer, int lengthToSkip) Rewrite buffer in order to skip lengthToSkip bytes from current readerIndex, such that any readable bytes available after readerIndex + lengthToSkip (so before writerIndex) are moved at readerIndex position, therefore decreasing writerIndex of lengthToSkip at the end of the process.
| |
| setDiscardThreshold | back to summary |
|---|---|
| public void setDiscardThreshold(int discardThreshold) Implements io. Set the amount of bytes after which read bytes in the buffer should be discarded.
Setting this lower gives lower memory usage but with the overhead of more memory copies.
Use
| |
| skipControlCharacters | back to summary |
|---|---|
| private static void skipControlCharacters(ByteBuf undecodedChunk) Skip control Characters | |
| skipControlCharactersStandard | back to summary |
|---|---|
| private static void skipControlCharactersStandard(ByteBuf undecodedChunk) | |
| skipOneLine | back to summary |
|---|---|
| private boolean skipOneLine() Skip one empty line
| |
| splitMultipartHeader | back to summary |
|---|---|
| private static String[] splitMultipartHeader(String sb) Split one header in Multipart
| |
| splitMultipartHeaderValues | back to summary |
|---|---|
| private static String[] splitMultipartHeaderValues(String svalue) Split one header value in Multipart
| |