public class HttpPostStandardRequestDecoder extends java.lang.Object implements InterfaceHttpPostRequestDecoder
| 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 status
|
private HttpDataFactory |
factory
Factory used to create InterfaceHttpData
|
private boolean |
isLastChunk
Does the last chunk already received
|
private HttpRequest |
request
Request to decode
|
private ChannelBuffer |
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 |
|---|---|
private void |
addHttpData(InterfaceHttpData data)
Utility function to add a new decoded data
|
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
|
InterfaceHttpData |
getBodyHttpData(java.lang.String name)
This method returns the first InterfaceHttpData with the given name from body.
If chunked, all chunks must have been offered using offer() method. |
java.util.List<InterfaceHttpData> |
getBodyHttpDatas()
This method returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() method. |
java.util.List<InterfaceHttpData> |
getBodyHttpDatas(java.lang.String name)
This method returns a List of all HttpDatas with the given name from body.
If chunked, all chunks must have been offered using offer() method. |
boolean |
hasNext()
True if at current status, 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.
|
void |
offer(HttpChunk chunk)
Initialized the internals from a new chunk
|
private void |
parseBody()
This method will parse as much as possible data and fill the list and map
|
private void |
parseBodyAttributes()
This method fill the map and list with as much Attribute as possible from Body in
not Multipart mode.
|
private void |
parseBodyAttributesStandard()
This method 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
|
private void |
setFinalBuffer(ChannelBuffer buffer) |
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 ChannelBuffer undecodedChunk
private int bodyListHttpDataRank
private HttpPostRequestDecoder.MultiPartStatus currentStatus
private Attribute currentAttribute
public HttpPostStandardRequestDecoder(HttpRequest request) throws HttpPostRequestDecoder.ErrorDataDecoderException
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) throws HttpPostRequestDecoder.ErrorDataDecoderException
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) throws HttpPostRequestDecoder.ErrorDataDecoderException
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 errorspublic boolean isMultipart()
InterfaceHttpPostRequestDecoderisMultipart in interface InterfaceHttpPostRequestDecoderpublic java.util.List<InterfaceHttpData> getBodyHttpDatas() throws HttpPostRequestDecoder.NotEnoughDataDecoderException
InterfaceHttpPostRequestDecodergetBodyHttpDatas in interface InterfaceHttpPostRequestDecoderHttpPostRequestDecoder.NotEnoughDataDecoderException - Need more chunkspublic java.util.List<InterfaceHttpData> getBodyHttpDatas(java.lang.String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException
InterfaceHttpPostRequestDecodergetBodyHttpDatas in interface InterfaceHttpPostRequestDecoderHttpPostRequestDecoder.NotEnoughDataDecoderException - need more chunkspublic InterfaceHttpData getBodyHttpData(java.lang.String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException
InterfaceHttpPostRequestDecodergetBodyHttpData in interface InterfaceHttpPostRequestDecoderHttpPostRequestDecoder.NotEnoughDataDecoderException - need more chunkspublic void offer(HttpChunk chunk) throws HttpPostRequestDecoder.ErrorDataDecoderException
InterfaceHttpPostRequestDecoderoffer in interface InterfaceHttpPostRequestDecoderchunk - the new received chunkHttpPostRequestDecoder.ErrorDataDecoderException - if there is a problem with the charset decoding or
other errorspublic boolean hasNext()
throws HttpPostRequestDecoder.EndOfDataDecoderException
InterfaceHttpPostRequestDecoderhasNext in interface InterfaceHttpPostRequestDecoderHttpPostRequestDecoder.EndOfDataDecoderException - No more data will be availablepublic InterfaceHttpData next() throws HttpPostRequestDecoder.EndOfDataDecoderException
InterfaceHttpPostRequestDecodernext in interface InterfaceHttpPostRequestDecoderHttpPostRequestDecoder.EndOfDataDecoderException - No more data will be availableprivate void parseBody()
throws HttpPostRequestDecoder.ErrorDataDecoderException
HttpPostRequestDecoder.ErrorDataDecoderException - if there is a problem with the charset decoding or
other errorsprivate void addHttpData(InterfaceHttpData data)
private void parseBodyAttributesStandard()
throws HttpPostRequestDecoder.ErrorDataDecoderException
HttpPostRequestDecoder.ErrorDataDecoderException - if there is a problem with the charset decoding or
other errorsprivate void parseBodyAttributes()
throws HttpPostRequestDecoder.ErrorDataDecoderException
HttpPostRequestDecoder.ErrorDataDecoderException - if there is a problem with the charset decoding or
other errorsprivate void setFinalBuffer(ChannelBuffer buffer) throws HttpPostRequestDecoder.ErrorDataDecoderException, java.io.IOException
HttpPostRequestDecoder.ErrorDataDecoderExceptionjava.io.IOExceptionprivate static java.lang.String decodeAttribute(java.lang.String s,
java.nio.charset.Charset charset)
throws HttpPostRequestDecoder.ErrorDataDecoderException
HttpPostRequestDecoder.ErrorDataDecoderExceptionpublic void cleanFiles()
InterfaceHttpPostRequestDecodercleanFiles in interface InterfaceHttpPostRequestDecoderpublic void removeHttpDataFromClean(InterfaceHttpData data)
InterfaceHttpPostRequestDecoderremoveHttpDataFromClean in interface InterfaceHttpPostRequestDecoder