Top Description Inners Fields Constructors Methods
io.netty.handler.codec.http.multipart

public Class HttpPostStandardRequestDecoder

extends Object
implements InterfaceHttpPostRequestDecoder
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.handler.codec.http.HttpConstants, .HttpContent, .HttpRequest, .LastHttpContent, .QueryStringDecoder, io.netty.handler.codec.http.multipart.HttpPostBodyUtil.SeekAheadOptimize, .HttpPostRequestDecoder.EndOfDataDecoderException, .HttpPostRequestDecoder.ErrorDataDecoderException, .HttpPostRequestDecoder.MultiPartStatus, .HttpPostRequestDecoder.NotEnoughDataDecoderException, io.netty.util.ByteProcessor, io.netty.util.internal.PlatformDependent, .StringUtil, java.io.IOException, java.nio.charset.Charset, java.util.ArrayList, .List, .Map, .TreeMap

This decoder will decode Body and can handle POST BODY. You MUST call destroy() after completion to release all resources.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final List<InterfaceHttpData>
bodyListHttpData

HttpDatas from Body

private int
bodyListHttpDataRank

Body HttpDatas current position

private final Map<String, List<InterfaceHttpData>>
bodyMapHttpData

HttpDatas as Map from Body

private final 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
private int
private final HttpDataFactory
factory

Factory used to create InterfaceHttpData

private boolean
isLastChunk

Does the last chunk already received

private final HttpRequest
request

Request to decode

private ByteBuf
undecodedChunk

The current channelBuffer

Constructor Summary

AccessConstructor and Description
public
HttpPostStandardRequestDecoder(HttpRequest
the request to decode
request
)

public
HttpPostStandardRequestDecoder(HttpDataFactory
the factory used to create InterfaceHttpData
factory
,
HttpRequest
the request to decode
request
)

public
HttpPostStandardRequestDecoder(HttpDataFactory
the factory used to create InterfaceHttpData
factory
,
HttpRequest
the request to decode
request
,
Charset
the charset to use as default
charset
)

Method Summary

Modifier and TypeMethod and Description
protected void
addHttpData(InterfaceHttpData data)

Utility function to add a new decoded data

private void
public void
public InterfaceHttpData
currentPartialHttpData()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.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).
private static String

Returns:

the decoded component
decodeAttribute
(String s, Charset charset)

Decode component

private static ByteBuf
public void
public InterfaceHttpData

Returns:

The first Body InterfaceHttpData with the given name (ignore case)
getBodyHttpData
(String name)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getBodyHttpData.

This getMethod returns the first InterfaceHttpData with the given name from body.
public List<InterfaceHttpData>

Returns:

the list of HttpDatas from Body part for POST getMethod
getBodyHttpDatas
()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getBodyHttpDatas.

This getMethod returns a List of all HttpDatas from body.
public List<InterfaceHttpData>

Returns:

All Body HttpDatas with the given name (ignore case)
getBodyHttpDatas
(String name)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getBodyHttpDatas.

This getMethod returns a List of all HttpDatas with the given name from body.
public int
getDiscardThreshold()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getDiscardThreshold.

Return the threshold in bytes after which read data in the buffer should be discarded.
public boolean

Returns:

True if at current getStatus, there is a decoded InterfaceHttpData
hasNext
()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.hasNext.

True if at current getStatus, there is an available decoded InterfaceHttpData from the Body.
public boolean

Returns:

True if this request is a Multipart request
isMultipart
()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.isMultipart.

True if this request is a Multipart request
public InterfaceHttpData

Returns:

the next available InterfaceHttpData or null if none
next
()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.next.

Returns the next available InterfaceHttpData or null if, at the time it is called, there is no more available InterfaceHttpData.
public HttpPostStandardRequestDecoder
offer(HttpContent
the new received chunk
content
)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.offer.

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.

public void
public void
setDiscardThreshold(int discardThreshold)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.setDiscardThreshold.

Set the amount of bytes after which read bytes in the buffer should be discarded.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyListHttpDataback to summary
private final List<InterfaceHttpData> bodyListHttpData

HttpDatas from Body

bodyListHttpDataRankback to summary
private int bodyListHttpDataRank

Body HttpDatas current position

bodyMapHttpDataback to summary
private final Map<String, List<InterfaceHttpData>> bodyMapHttpData

HttpDatas as Map from Body

charsetback to summary
private final Charset charset

Default charset to use

currentAttributeback to summary
private Attribute currentAttribute

The current Attribute that is currently in decode process

currentStatusback to summary
private HttpPostRequestDecoder.MultiPartStatus currentStatus

Current getStatus

destroyedback to summary
private boolean destroyed
discardThresholdback to summary
private int discardThreshold
factoryback to summary
private final HttpDataFactory factory

Factory used to create InterfaceHttpData

isLastChunkback to summary
private boolean isLastChunk

Does the last chunk already received

requestback to summary
private final HttpRequest request

Request to decode

undecodedChunkback to summary
private ByteBuf undecodedChunk

The current channelBuffer

Constructor Detail

HttpPostStandardRequestDecoderback to summary
public HttpPostStandardRequestDecoder(HttpRequest request)
Parameters
request:HttpRequest

the request to decode

Exceptions
NullPointerException:
for request
ErrorDataDecoderException:
if the default charset was wrong when decoding or other errors
HttpPostStandardRequestDecoderback to summary
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request)
Parameters
factory:HttpDataFactory

the factory used to create InterfaceHttpData

request:HttpRequest

the request to decode

Exceptions
NullPointerException:
for request or factory
ErrorDataDecoderException:
if the default charset was wrong when decoding or other errors
HttpPostStandardRequestDecoderback to summary
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset)
Parameters
factory:HttpDataFactory

the factory used to create InterfaceHttpData

request:HttpRequest

the request to decode

charset:Charset

the charset to use as default

Exceptions
NullPointerException:
for request or charset or factory
ErrorDataDecoderException:
if the default charset was wrong when decoding or other errors

Method Detail

addHttpDataback to summary
protected void addHttpData(InterfaceHttpData data)

Utility function to add a new decoded data

checkDestroyedback to summary
private void checkDestroyed()
cleanFilesback to summary
public void cleanFiles()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.cleanFiles.

Clean all HttpDatas for the current request.

Annotations
@Override
currentPartialHttpDataback to summary
public InterfaceHttpData currentPartialHttpData()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.currentPartialHttpData.

Doc from io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.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:InterfaceHttpData

the current InterfaceHttpData if currently in decoding status or null if none.

Annotations
@Override
decodeAttributeback to summary
private static String decodeAttribute(String s, Charset charset)

Decode component

Returns:String

the decoded component

decodeAttributeback to summary
private static ByteBuf decodeAttribute(ByteBuf b, Charset charset)
destroyback to summary
public void destroy()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.destroy.

Destroy the HttpPostStandardRequestDecoder and release all it resources. After this method was called it is not possible to operate on it anymore.

Annotations
@Override
getBodyHttpDataback to summary
public InterfaceHttpData getBodyHttpData(String name)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getBodyHttpData.

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:InterfaceHttpData

The first Body InterfaceHttpData with the given name (ignore case)

Annotations
@Override
Exceptions
NotEnoughDataDecoderException:
need more chunks
getBodyHttpDatasback to summary
public List<InterfaceHttpData> getBodyHttpDatas()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.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:List<InterfaceHttpData>

the list of HttpDatas from Body part for POST getMethod

Annotations
@Override
Exceptions
NotEnoughDataDecoderException:
Need more chunks
getBodyHttpDatasback to summary
public List<InterfaceHttpData> getBodyHttpDatas(String name)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getBodyHttpDatas.

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:List<InterfaceHttpData>

All Body HttpDatas with the given name (ignore case)

Annotations
@Override
Exceptions
NotEnoughDataDecoderException:
need more chunks
getDiscardThresholdback to summary
public int getDiscardThreshold()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.getDiscardThreshold.

Return the threshold in bytes after which read data in the buffer should be discarded.

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.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:boolean

True if at current getStatus, there is a decoded InterfaceHttpData

Annotations
@Override
Exceptions
EndOfDataDecoderException:
No more data will be available
isMultipartback to summary
public boolean isMultipart()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.isMultipart.

True if this request is a Multipart request

Returns:boolean

True if this request is a Multipart request

Annotations
@Override
nextback to summary
public InterfaceHttpData next()

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.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 call InterfaceHttpData#release() after you are done with processing to make sure to not leak any resources

Returns:InterfaceHttpData

the next available InterfaceHttpData or null if none

Annotations
@Override
Exceptions
EndOfDataDecoderException:
No more data will be available
offerback to summary
public HttpPostStandardRequestDecoder offer(HttpContent content)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.offer.

Initialized the internals from a new chunk

Parameters
content:HttpContent

the new received chunk

Annotations
@Override
Exceptions
ErrorDataDecoderException:
if there is a problem with the charset decoding or other errors
parseBodyback to summary
private void parseBody()

This getMethod will parse as much as possible data and fill the list and map

Exceptions
ErrorDataDecoderException:
if there is a problem with the charset decoding or other errors
parseBodyAttributesback to summary
private void parseBodyAttributes()

This getMethod fill the map and list with as much Attribute as possible from Body in not Multipart mode.

Exceptions
ErrorDataDecoderException:
if there is a problem with the charset decoding or other errors
parseBodyAttributesStandardback to summary
private void parseBodyAttributesStandard()

This getMethod fill the map and list with as much Attribute as possible from Body in not Multipart mode.

Exceptions
ErrorDataDecoderException:
if there is a problem with the charset decoding or other errors
removeHttpDataFromCleanback to summary
public void removeHttpDataFromClean(InterfaceHttpData data)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.removeHttpDataFromClean.

Remove the given FileUpload from the list of FileUploads to clean

Annotations
@Override
setDiscardThresholdback to summary
public void setDiscardThreshold(int discardThreshold)

Implements io.netty.handler.codec.http.multipart.InterfaceHttpPostRequestDecoder.setDiscardThreshold.

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. Use 0 to disable it.

Annotations
@Override
setFinalBufferback to summary
private void setFinalBuffer(ByteBuf buffer) throws IOException
io.netty.handler.codec.http.multipart back to summary

private final Class HttpPostStandardRequestDecoder.UrlDecoder

extends Object
implements ByteProcessor
Class Inheritance
  • java.lang.Object
  • io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.UrlDecoder
All Implemented Interfaces
io.netty.util.ByteProcessor

Field Summary

Modifier and TypeField and Description
private byte
private int
private final ByteBuf

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hiByteback to summary
private byte hiByte
nextEscapedIdxback to summary
private int nextEscapedIdx
outputback to summary
private final ByteBuf output

Constructor Detail

UrlDecoderback to summary
pack-priv UrlDecoder(ByteBuf output)

Method Detail

processback to summary
public boolean process(byte value)

Implements io.netty.util.ByteProcessor.process.

Returns:boolean

Doc from io.netty.util.ByteProcessor.process.

true if the processor wants to continue the loop and handle the next byte in the buffer. false if the processor wants to stop handling bytes and abort the loop.

Annotations
@Override
io.netty.handler.codec.http.multipart back to summary

private final Class HttpPostStandardRequestDecoder.UrlEncodedDetector

extends Object
implements ByteProcessor
Class Inheritance
  • java.lang.Object
  • io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.UrlEncodedDetector
All Implemented Interfaces
io.netty.util.ByteProcessor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UrlEncodedDetectorback to summary
private UrlEncodedDetector()

Method Detail

processback to summary
public boolean process(byte value) throws Exception

Implements io.netty.util.ByteProcessor.process.

Returns:boolean

Doc from io.netty.util.ByteProcessor.process.

true if the processor wants to continue the loop and handle the next byte in the buffer. false if the processor wants to stop handling bytes and abort the loop.

Annotations
@Override