public class HttpPostStandardRequestDecoder extends java.lang.Object implements InterfaceHttpPostRequestDecoder
destroy()
after completion to release all resources.Modifier and Type | Field and Description |
---|---|
private java.util.List<InterfaceHttpData> |
bodyListHttpData
HttpDatas from Body
|
private int |
bodyListHttpDataRank
Body HttpDatas current position
|
private java.util.Map<java.lang.String,java.util.List<InterfaceHttpData>> |
bodyMapHttpData
HttpDatas as Map from Body
|
private java.nio.charset.Charset |
charset
Default charset to use
|
private Attribute |
currentAttribute
The current Attribute that is currently in decode process
|
private HttpPostRequestDecoder.MultiPartStatus |
currentStatus
Current getStatus
|
private boolean |
destroyed |
private int |
discardThreshold |
private HttpDataFactory |
factory
Factory used to create InterfaceHttpData
|
private boolean |
isLastChunk
Does the last chunk already received
|
private HttpRequest |
request
Request to decode
|
private ByteBuf |
undecodedChunk
The current channelBuffer
|
Constructor and Description |
---|
HttpPostStandardRequestDecoder(HttpDataFactory factory,
HttpRequest request) |
HttpPostStandardRequestDecoder(HttpDataFactory factory,
HttpRequest request,
java.nio.charset.Charset charset) |
HttpPostStandardRequestDecoder(HttpRequest request) |
Modifier and Type | Method and Description |
---|---|
protected void |
addHttpData(InterfaceHttpData data)
Utility function to add a new decoded data
|
private void |
checkDestroyed() |
void |
cleanFiles()
Clean all HttpDatas (on Disk) for the current request.
|
private static java.lang.String |
decodeAttribute(java.lang.String s,
java.nio.charset.Charset charset)
Decode component
|
void |
destroy()
Destroy the
HttpPostStandardRequestDecoder and release all it resources. |
InterfaceHttpData |
getBodyHttpData(java.lang.String name)
This getMethod returns the first InterfaceHttpData with the given name from
body.
If chunked, all chunks must have been offered using offer() getMethod. |
java.util.List<InterfaceHttpData> |
getBodyHttpDatas()
This getMethod returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() getMethod. |
java.util.List<InterfaceHttpData> |
getBodyHttpDatas(java.lang.String name)
This getMethod returns a List of all HttpDatas with the given name from
body.
If chunked, all chunks must have been offered using offer() getMethod. |
int |
getDiscardThreshold()
Return the threshold in bytes after which read data in the buffer should be discarded.
|
boolean |
hasNext()
True if at current getStatus, there is an available decoded
InterfaceHttpData from the Body.
|
boolean |
isMultipart()
True if this request is a Multipart request
|
InterfaceHttpData |
next()
Returns the next available InterfaceHttpData or null if, at the time it
is called, there is no more available InterfaceHttpData.
|
HttpPostStandardRequestDecoder |
offer(HttpContent content)
Initialized the internals from a new chunk
|
private void |
parseBody()
This getMethod will parse as much as possible data and fill the list and map
|
private void |
parseBodyAttributes()
This getMethod fill the map and list with as much Attribute as possible from
Body in not Multipart mode.
|
private void |
parseBodyAttributesStandard()
This getMethod fill the map and list with as much Attribute as possible from
Body in not Multipart mode.
|
void |
removeHttpDataFromClean(InterfaceHttpData data)
Remove the given FileUpload from the list of FileUploads to clean
|
void |
setDiscardThreshold(int discardThreshold)
Set the amount of bytes after which read bytes in the buffer should be discarded.
|
private void |
setFinalBuffer(ByteBuf buffer) |
(package private) void |
skipControlCharacters()
Skip control Characters
|
(package private) void |
skipControlCharactersStandard() |
private final HttpDataFactory factory
private final HttpRequest request
private final java.nio.charset.Charset charset
private boolean isLastChunk
private final java.util.List<InterfaceHttpData> bodyListHttpData
private final java.util.Map<java.lang.String,java.util.List<InterfaceHttpData>> bodyMapHttpData
private ByteBuf undecodedChunk
private int bodyListHttpDataRank
private HttpPostRequestDecoder.MultiPartStatus currentStatus
private Attribute currentAttribute
private boolean destroyed
private int discardThreshold
public HttpPostStandardRequestDecoder(HttpRequest request)
request
- the request to decodejava.lang.NullPointerException
- for requestHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorspublic HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request)
factory
- the factory used to create InterfaceHttpDatarequest
- the request to decodejava.lang.NullPointerException
- for request or factoryHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorspublic HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request, java.nio.charset.Charset charset)
factory
- the factory used to create InterfaceHttpDatarequest
- the request to decodecharset
- the charset to use as defaultjava.lang.NullPointerException
- for request or charset or factoryHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorsprivate void checkDestroyed()
public boolean isMultipart()
isMultipart
in interface InterfaceHttpPostRequestDecoder
public void setDiscardThreshold(int discardThreshold)
0
to disable it.setDiscardThreshold
in interface InterfaceHttpPostRequestDecoder
public int getDiscardThreshold()
getDiscardThreshold
in interface InterfaceHttpPostRequestDecoder
public java.util.List<InterfaceHttpData> getBodyHttpDatas()
getBodyHttpDatas
in interface InterfaceHttpPostRequestDecoder
HttpPostRequestDecoder.NotEnoughDataDecoderException
- Need more chunkspublic java.util.List<InterfaceHttpData> getBodyHttpDatas(java.lang.String name)
getBodyHttpDatas
in interface InterfaceHttpPostRequestDecoder
HttpPostRequestDecoder.NotEnoughDataDecoderException
- need more chunkspublic InterfaceHttpData getBodyHttpData(java.lang.String name)
getBodyHttpData
in interface InterfaceHttpPostRequestDecoder
HttpPostRequestDecoder.NotEnoughDataDecoderException
- need more chunkspublic HttpPostStandardRequestDecoder offer(HttpContent content)
offer
in interface InterfaceHttpPostRequestDecoder
content
- the new received chunkHttpPostRequestDecoder.ErrorDataDecoderException
- if there is a problem with the charset decoding or other
errorspublic boolean hasNext()
hasNext
in interface InterfaceHttpPostRequestDecoder
HttpPostRequestDecoder.EndOfDataDecoderException
- No more data will be availablepublic InterfaceHttpData next()
ReferenceCounted.release()
after you are done
with processing to make sure to not leak any resourcesnext
in interface InterfaceHttpPostRequestDecoder
HttpPostRequestDecoder.EndOfDataDecoderException
- No more data will be availableprivate void parseBody()
HttpPostRequestDecoder.ErrorDataDecoderException
- if there is a problem with the charset decoding or other
errorsprotected void addHttpData(InterfaceHttpData data)
private void parseBodyAttributesStandard()
HttpPostRequestDecoder.ErrorDataDecoderException
- if there is a problem with the charset decoding or other
errorsprivate void parseBodyAttributes()
HttpPostRequestDecoder.ErrorDataDecoderException
- if there is a problem with the charset decoding or other
errorsprivate void setFinalBuffer(ByteBuf buffer) throws java.io.IOException
java.io.IOException
private static java.lang.String decodeAttribute(java.lang.String s, java.nio.charset.Charset charset)
void skipControlCharacters()
void skipControlCharactersStandard()
public void destroy()
HttpPostStandardRequestDecoder
and release all it resources. After this method
was called it is not possible to operate on it anymore.destroy
in interface InterfaceHttpPostRequestDecoder
public void cleanFiles()
cleanFiles
in interface InterfaceHttpPostRequestDecoder
public void removeHttpDataFromClean(InterfaceHttpData data)
removeHttpDataFromClean
in interface InterfaceHttpPostRequestDecoder