Interface InterfaceHttpPostRequestDecoder
-
- All Known Implementing Classes:
HttpPostMultipartRequestDecoder,HttpPostRequestDecoder,HttpPostStandardRequestDecoder
public interface InterfaceHttpPostRequestDecoderThis decoder will decode Body and can handle POST BODY. You MUST calldestroy()after completion to release all resources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcleanFiles()Clean all HttpDatas (on Disk) for the current request.InterfaceHttpDatacurrentPartialHttpData()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).voiddestroy()Destroy theInterfaceHttpPostRequestDecoderand release all it resources.InterfaceHttpDatagetBodyHttpData(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.List<InterfaceHttpData>getBodyHttpDatas()This getMethod returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() getMethod.List<InterfaceHttpData>getBodyHttpDatas(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.intgetDiscardThreshold()Return the threshold in bytes after which read data in the buffer should be discarded.booleanhasNext()True if at current getStatus, there is an available decoded InterfaceHttpData from the Body.booleanisMultipart()True if this request is a Multipart requestInterfaceHttpDatanext()Returns the next available InterfaceHttpData or null if, at the time it is called, there is no more available InterfaceHttpData.InterfaceHttpPostRequestDecoderoffer(HttpContent content)Initialized the internals from a new chunkvoidremoveHttpDataFromClean(InterfaceHttpData data)Remove the given FileUpload from the list of FileUploads to cleanvoidsetDiscardThreshold(int discardThreshold)Set the amount of bytes after which read bytes in the buffer should be discarded.
-
-
-
Method Detail
-
isMultipart
boolean isMultipart()
True if this request is a Multipart request- Returns:
- True if this request is a Multipart request
-
setDiscardThreshold
void setDiscardThreshold(int discardThreshold)
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. Use0to disable it.
-
getDiscardThreshold
int getDiscardThreshold()
Return the threshold in bytes after which read data in the buffer should be discarded.
-
getBodyHttpDatas
List<InterfaceHttpData> getBodyHttpDatas()
This getMethod returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() getMethod. If not, NotEnoughDataDecoderException will be raised.- Returns:
- the list of HttpDatas from Body part for POST getMethod
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- Need more chunks
-
getBodyHttpDatas
List<InterfaceHttpData> getBodyHttpDatas(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. If not, NotEnoughDataDecoderException will be raised.- Returns:
- All Body HttpDatas with the given name (ignore case)
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
getBodyHttpData
InterfaceHttpData getBodyHttpData(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. If not, NotEnoughDataDecoderException will be raised.- Returns:
- The first Body InterfaceHttpData with the given name (ignore case)
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
offer
InterfaceHttpPostRequestDecoder offer(HttpContent content)
Initialized the internals from a new chunk- Parameters:
content- the new received chunk- Throws:
HttpPostRequestDecoder.ErrorDataDecoderException- if there is a problem with the charset decoding or other errors
-
hasNext
boolean hasNext()
True if at current getStatus, there is an available decoded InterfaceHttpData from the Body. This getMethod works for chunked and not chunked request.- Returns:
- True if at current getStatus, there is a decoded InterfaceHttpData
- Throws:
HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
next
InterfaceHttpData next()
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 callReferenceCounted.release()after you are done with processing to make sure to not leak any resources- Returns:
- the next available InterfaceHttpData or null if none
- Throws:
HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
currentPartialHttpData
InterfaceHttpData currentPartialHttpData()
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.- Returns:
- the current InterfaceHttpData if currently in decoding status or null if none.
-
destroy
void destroy()
Destroy theInterfaceHttpPostRequestDecoderand release all it resources. After this method was called it is not possible to operate on it anymore.
-
cleanFiles
void cleanFiles()
Clean all HttpDatas (on Disk) for the current request.
-
removeHttpDataFromClean
void removeHttpDataFromClean(InterfaceHttpData data)
Remove the given FileUpload from the list of FileUploads to clean
-
-