Class HttpPostMultipartRequestDecoder
java.lang.Object
org.jboss.netty.handler.codec.http.multipart.HttpPostMultipartRequestDecoder
- All Implemented Interfaces:
InterfaceHttpPostRequestDecoder
public class HttpPostMultipartRequestDecoder
extends Object
implements InterfaceHttpPostRequestDecoder
This decoder will decode Body and can handle POST BODY in multipart form.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset, int maxFields, int maxBufferedBytes) -
Method Summary
Modifier and TypeMethodDescriptionvoidClean all HttpDatas (on Disk) for the current request.getBodyHttpData(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.This method returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() method.getBodyHttpDatas(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.booleanhasNext()True if at current status, there is an available decoded InterfaceHttpData from the Body.booleanTrue if this request is a Multipart requestnext()Returns the next available InterfaceHttpData or null if, at the time it is called, there is no more available InterfaceHttpData.voidInitialized the internals from a new chunkvoidRemove the given FileUpload from the list of FileUploads to clean
-
Constructor Details
-
HttpPostMultipartRequestDecoder
public HttpPostMultipartRequestDecoder(HttpRequest request) throws HttpPostRequestDecoder.ErrorDataDecoderException - Parameters:
request- the request to decode- Throws:
NullPointerException- for requestHttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
HttpPostMultipartRequestDecoder
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) throws HttpPostRequestDecoder.ErrorDataDecoderException - Parameters:
factory- the factory used to create InterfaceHttpDatarequest- the request to decode- Throws:
NullPointerException- for request or factoryHttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
HttpPostMultipartRequestDecoder
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) throws HttpPostRequestDecoder.ErrorDataDecoderException - Parameters:
factory- the factory used to create InterfaceHttpDatarequest- the request to decodecharset- the charset to use as default- Throws:
NullPointerException- for request or charset or factoryHttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
HttpPostMultipartRequestDecoder
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset, int maxFields, int maxBufferedBytes) throws HttpPostRequestDecoder.ErrorDataDecoderException - Parameters:
factory- the factory used to create InterfaceHttpDatarequest- the request to decodecharset- the charset to use as defaultmaxFields- the maximum number of fields the form can have,-1to disablemaxBufferedBytes- the maximum number of bytes the decoder can buffer when decoding a field,-1to disable- Throws:
NullPointerException- for request or charset or factoryHttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
-
Method Details
-
isMultipart
public boolean isMultipart()Description copied from interface:InterfaceHttpPostRequestDecoderTrue if this request is a Multipart request- Specified by:
isMultipartin interfaceInterfaceHttpPostRequestDecoder- Returns:
- True if this request is a Multipart request
-
getBodyHttpDatas
public List<InterfaceHttpData> getBodyHttpDatas() throws HttpPostRequestDecoder.NotEnoughDataDecoderExceptionDescription copied from interface:InterfaceHttpPostRequestDecoderThis method returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() method. If not, NotEnoughDataDecoderException will be raised.- Specified by:
getBodyHttpDatasin interfaceInterfaceHttpPostRequestDecoder- Returns:
- the list of HttpDatas from Body part for POST method
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- Need more chunks
-
getBodyHttpDatas
public List<InterfaceHttpData> getBodyHttpDatas(String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException Description copied from interface:InterfaceHttpPostRequestDecoderThis method returns a List of all HttpDatas with the given name from body.
If chunked, all chunks must have been offered using offer() method. If not, NotEnoughDataDecoderException will be raised.- Specified by:
getBodyHttpDatasin interfaceInterfaceHttpPostRequestDecoder- Returns:
- All Body HttpDatas with the given name (ignore case)
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
getBodyHttpData
public InterfaceHttpData getBodyHttpData(String name) throws HttpPostRequestDecoder.NotEnoughDataDecoderException Description copied from interface:InterfaceHttpPostRequestDecoderThis method returns the first InterfaceHttpData with the given name from body.
If chunked, all chunks must have been offered using offer() method. If not, NotEnoughDataDecoderException will be raised.- Specified by:
getBodyHttpDatain interfaceInterfaceHttpPostRequestDecoder- Returns:
- The first Body InterfaceHttpData with the given name (ignore case)
- Throws:
HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
offer
Description copied from interface:InterfaceHttpPostRequestDecoderInitialized the internals from a new chunk- Specified by:
offerin interfaceInterfaceHttpPostRequestDecoder- Parameters:
chunk- the new received chunk- Throws:
HttpPostRequestDecoder.ErrorDataDecoderException- if there is a problem with the charset decoding or other errors
-
hasNext
Description copied from interface:InterfaceHttpPostRequestDecoderTrue if at current status, there is an available decoded InterfaceHttpData from the Body. This method works for chunked and not chunked request.- Specified by:
hasNextin interfaceInterfaceHttpPostRequestDecoder- Returns:
- True if at current status, there is a decoded InterfaceHttpData
- Throws:
HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
next
Description copied from interface:InterfaceHttpPostRequestDecoderReturns 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.- Specified by:
nextin interfaceInterfaceHttpPostRequestDecoder- Returns:
- the next available InterfaceHttpData or null if none
- Throws:
HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
cleanFiles
public void cleanFiles()Description copied from interface:InterfaceHttpPostRequestDecoderClean all HttpDatas (on Disk) for the current request.- Specified by:
cleanFilesin interfaceInterfaceHttpPostRequestDecoder
-
removeHttpDataFromClean
Description copied from interface:InterfaceHttpPostRequestDecoderRemove the given FileUpload from the list of FileUploads to clean- Specified by:
removeHttpDataFromCleanin interfaceInterfaceHttpPostRequestDecoder
-