Modifier and Type | Class and Description |
---|---|
static class |
HttpPostRequestDecoder.EndOfDataDecoderException
Exception when the body is fully decoded, even if there is still data
|
static class |
HttpPostRequestDecoder.ErrorDataDecoderException
Exception when an error occurs while decoding
|
static class |
HttpPostRequestDecoder.IncompatibleDataDecoderException
Exception when an unappropriated getMethod was called on a request
|
static class |
HttpPostRequestDecoder.NotEnoughDataDecoderException
Exception when try reading data from request in chunked format, and not
enough data are available (need more chunks)
|
Constructor and Description |
---|
HttpPostRequestDecoder(HttpDataFactory factory,
HttpRequest request) |
HttpPostRequestDecoder(HttpDataFactory factory,
HttpRequest request,
Charset charset) |
HttpPostRequestDecoder(HttpRequest request) |
Modifier and Type | Method and Description |
---|---|
protected void |
addHttpData(InterfaceHttpData data)
Utility function to add a new decoded data
|
void |
cleanFiles()
Clean all HttpDatas (on Disk) for the current request.
|
void |
destroy()
Destroy the
HttpPostRequestDecoder and release all it resources. |
InterfaceHttpData |
getBodyHttpData(String name)
This getMethod returns the first InterfaceHttpData with the given name from
body.
|
List<InterfaceHttpData> |
getBodyHttpDatas()
This getMethod returns a List of all HttpDatas from body.
|
List<InterfaceHttpData> |
getBodyHttpDatas(String name)
This getMethod returns a List of all HttpDatas with the given name from
body.
|
int |
getDiscardThreshold()
Return the threshold in bytes after which read data in the buffer should be discarded.
|
protected InterfaceHttpData |
getFileUpload(String delimiter)
Get the FileUpload (new one or current one)
|
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.
|
HttpPostRequestDecoder |
offer(HttpContent content)
Initialized the internals from a new chunk
|
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.
|
public HttpPostRequestDecoder(HttpRequest request) throws HttpPostRequestDecoder.ErrorDataDecoderException, HttpPostRequestDecoder.IncompatibleDataDecoderException
request
- the request to decodeNullPointerException
- for requestHttpPostRequestDecoder.IncompatibleDataDecoderException
- if the request has no body to decodeHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorspublic HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request) throws HttpPostRequestDecoder.ErrorDataDecoderException, HttpPostRequestDecoder.IncompatibleDataDecoderException
factory
- the factory used to create InterfaceHttpDatarequest
- the request to decodeNullPointerException
- for request or factoryHttpPostRequestDecoder.IncompatibleDataDecoderException
- if the request has no body to decodeHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorspublic HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) throws HttpPostRequestDecoder.ErrorDataDecoderException, HttpPostRequestDecoder.IncompatibleDataDecoderException
factory
- the factory used to create InterfaceHttpDatarequest
- the request to decodecharset
- the charset to use as defaultNullPointerException
- for request or charset or factoryHttpPostRequestDecoder.IncompatibleDataDecoderException
- if the request has no body to decodeHttpPostRequestDecoder.ErrorDataDecoderException
- if the default charset was wrong when decoding or other
errorspublic boolean isMultipart()
public void setDiscardThreshold(int discardThreshold)
0
to disable it.public int getDiscardThreshold()
public List<InterfaceHttpData> getBodyHttpDatas() throws HttpPostRequestDecoder.NotEnoughDataDecoderException
HttpPostRequestDecoder.NotEnoughDataDecoderException
- Need more chunkspublic List<InterfaceHttpData> getBodyHttpDatas(String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException
HttpPostRequestDecoder.NotEnoughDataDecoderException
- need more chunkspublic InterfaceHttpData getBodyHttpData(String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException
HttpPostRequestDecoder.NotEnoughDataDecoderException
- need more chunkspublic HttpPostRequestDecoder offer(HttpContent content) throws HttpPostRequestDecoder.ErrorDataDecoderException
content
- the new received chunkHttpPostRequestDecoder.ErrorDataDecoderException
- if there is a problem with the charset decoding or other
errorspublic boolean hasNext() throws HttpPostRequestDecoder.EndOfDataDecoderException
HttpPostRequestDecoder.EndOfDataDecoderException
- No more data will be availablepublic InterfaceHttpData next() throws HttpPostRequestDecoder.EndOfDataDecoderException
ReferenceCounted.release()
after you are done
with processing to make sure to not leak any resourcesHttpPostRequestDecoder.EndOfDataDecoderException
- No more data will be availableprotected void addHttpData(InterfaceHttpData data)
protected InterfaceHttpData getFileUpload(String delimiter) throws HttpPostRequestDecoder.ErrorDataDecoderException
delimiter
- the delimiter to useHttpPostRequestDecoder.ErrorDataDecoderException
public void destroy()
HttpPostRequestDecoder
and release all it resources. After this method
was called it is not possible to operate on it anymore.public void cleanFiles()
public void removeHttpDataFromClean(InterfaceHttpData data)
Copyright © 2008–2013 The Netty Project. All rights reserved.