Class QuarkusMultipartResponseDecoder
- java.lang.Object
-
- org.jboss.resteasy.reactive.client.impl.multipart.QuarkusMultipartResponseDecoder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classQuarkusMultipartResponseDecoder.MultiPartStatus
-
Constructor Summary
Constructors Constructor Description QuarkusMultipartResponseDecoder(io.vertx.core.http.HttpClientResponse response)QuarkusMultipartResponseDecoder(QuarkusMultipartResponseDataFactory factory, io.vertx.core.http.HttpClientResponse response)QuarkusMultipartResponseDecoder(QuarkusMultipartResponseDataFactory factory, io.vertx.core.http.HttpClientResponse response, Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddHttpData(io.netty.handler.codec.http.multipart.InterfaceHttpData data)Utility function to add a new decoded datavoidcleanFiles()Clean all HttpDatas (on Disk) for the current request.io.netty.handler.codec.http.multipart.InterfaceHttpDatacurrentPartialHttpData()voiddestroy()Destroy theQuarkusMultipartResponseDecoderand release all it resources.io.netty.handler.codec.http.multipart.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<io.netty.handler.codec.http.multipart.InterfaceHttpData>getBodyHttpDatas()This getMethod returns a List of all HttpDatas from body.
If chunked, all chunks must have been offered using offer() getMethod.List<io.netty.handler.codec.http.multipart.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.protected io.netty.handler.codec.http.multipart.InterfaceHttpDatagetFileUpload(String delimiter)Get the FileUpload (new one or current one)booleanhasNext()True if at current getStatus, there is an available decoded InterfaceHttpData from the Body.booleanisMultipart()True if this request is a Multipart requestio.netty.handler.codec.http.multipart.InterfaceHttpDatanext()Returns the next available InterfaceHttpData or null if, at the time it is called, there is no more available InterfaceHttpData.QuarkusMultipartResponseDecoderoffer(io.netty.handler.codec.http.HttpContent content)Initialized the internals from a new chunkQuarkusMultipartResponseDecoderoffer(io.vertx.core.buffer.Buffer content)voidremoveHttpDataFromClean(io.netty.handler.codec.http.multipart.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.
-
-
-
Constructor Detail
-
QuarkusMultipartResponseDecoder
public QuarkusMultipartResponseDecoder(io.vertx.core.http.HttpClientResponse response)
- Parameters:
response- the request to decode- Throws:
NullPointerException- for requestio.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
QuarkusMultipartResponseDecoder
public QuarkusMultipartResponseDecoder(QuarkusMultipartResponseDataFactory factory, io.vertx.core.http.HttpClientResponse response)
- Parameters:
factory- the factory used to create InterfaceHttpDataresponse- the request to decode- Throws:
NullPointerException- for request or factoryio.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
QuarkusMultipartResponseDecoder
public QuarkusMultipartResponseDecoder(QuarkusMultipartResponseDataFactory factory, io.vertx.core.http.HttpClientResponse response, Charset charset)
- Parameters:
factory- the factory used to create InterfaceHttpDataresponse- the request to decodecharset- the charset to use as default- Throws:
NullPointerException- for request or charset or factoryio.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException- if the default charset was wrong when decoding or other errors
-
-
Method Detail
-
isMultipart
public boolean isMultipart()
True if this request is a Multipart request- Returns:
- True if this request is a Multipart request
-
setDiscardThreshold
public 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
public int getDiscardThreshold()
Return the threshold in bytes after which read data in the buffer should be discarded.
-
getBodyHttpDatas
public List<io.netty.handler.codec.http.multipart.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:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.NotEnoughDataDecoderException- Need more chunks
-
getBodyHttpDatas
public List<io.netty.handler.codec.http.multipart.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:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
getBodyHttpData
public io.netty.handler.codec.http.multipart.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:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.NotEnoughDataDecoderException- need more chunks
-
offer
public QuarkusMultipartResponseDecoder offer(io.vertx.core.buffer.Buffer content)
-
offer
public QuarkusMultipartResponseDecoder offer(io.netty.handler.codec.http.HttpContent content)
Initialized the internals from a new chunk- Parameters:
content- the new received chunk- Throws:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException- if there is a problem with the charset decoding or other errors
-
hasNext
public 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:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
next
public io.netty.handler.codec.http.multipart.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:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.EndOfDataDecoderException- No more data will be available
-
currentPartialHttpData
public io.netty.handler.codec.http.multipart.InterfaceHttpData currentPartialHttpData()
-
addHttpData
protected void addHttpData(io.netty.handler.codec.http.multipart.InterfaceHttpData data)
Utility function to add a new decoded data
-
getFileUpload
protected io.netty.handler.codec.http.multipart.InterfaceHttpData getFileUpload(String delimiter)
Get the FileUpload (new one or current one)- Parameters:
delimiter- the delimiter to use- Returns:
- the InterfaceHttpData if any
- Throws:
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException- on decoder error
-
destroy
public void destroy()
Destroy theQuarkusMultipartResponseDecoderand release all it resources. After this method was called it is not possible to operate on it anymore.
-
cleanFiles
public void cleanFiles()
Clean all HttpDatas (on Disk) for the current request.
-
removeHttpDataFromClean
public void removeHttpDataFromClean(io.netty.handler.codec.http.multipart.InterfaceHttpData data)
Remove the given FileUpload from the list of FileUploads to clean
-
-