Class JsonContentProcessor
java.lang.Object
io.micronaut.http.server.netty.AbstractHttpContentProcessor
io.micronaut.http.server.netty.jackson.JsonContentProcessor
- All Implemented Interfaces:
Toggleable
,HttpContentProcessor
This class will handle subscribing to a JSON stream and binding once the events are complete in a non-blocking
manner.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from class io.micronaut.http.server.netty.AbstractHttpContentProcessor
advertisedLength, configuration, nettyHttpRequest, receivedLength, requestMaxSize
-
Constructor Summary
ConstructorDescriptionJsonContentProcessor
(NettyHttpRequest<?> nettyHttpRequest, NettyHttpServerConfiguration configuration, JsonMapper jsonMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete
(Collection<Object> out) Finish processing data.protected void
onData
(io.netty.buffer.ByteBufHolder message, Collection<Object> out) Called after verifying the data of the message.processSingle
(io.netty.buffer.ByteBuf data) Process a singleByteBuf
into a single item, if possible.resultType
(Argument<?> type) Set the type of the values returned by this processor.Methods inherited from class io.micronaut.http.server.netty.AbstractHttpContentProcessor
add, fireExceedsLength
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.server.netty.HttpContentProcessor
cancel
Methods inherited from interface io.micronaut.core.util.Toggleable
isEnabled
-
Constructor Details
-
JsonContentProcessor
public JsonContentProcessor(NettyHttpRequest<?> nettyHttpRequest, NettyHttpServerConfiguration configuration, JsonMapper jsonMapper) - Parameters:
nettyHttpRequest
- The Netty Http requestconfiguration
- The Http server configurationjsonMapper
- The json codec
-
-
Method Details
-
resultType
Description copied from interface:HttpContentProcessor
Set the type of the values returned by this processor. Most processors do not respect this setting, but e.g. theJsonContentProcessor
does.- Parameters:
type
- The type produced by this processor- Returns:
- This processor, for chaining
-
processSingle
Description copied from interface:HttpContentProcessor
Process a singleByteBuf
into a single item, if possible.- Parameters:
data
- The input data- Returns:
- The output value, or
null
if this is unsupported. - Throws:
Throwable
- Any failure
-
onData
protected void onData(io.netty.buffer.ByteBufHolder message, Collection<Object> out) throws Throwable Description copied from class:AbstractHttpContentProcessor
Called after verifying the data of the message.- Specified by:
onData
in classAbstractHttpContentProcessor
- Parameters:
message
- The messageout
- The collection to add any produced messages to- Throws:
Throwable
-
complete
Description copied from interface:HttpContentProcessor
Finish processing data.- Parameters:
out
- The collection to add remaining output items to- Throws:
Throwable
-