Class JsonContentProcessor
java.lang.Object
io.micronaut.http.server.netty.AbstractHttpContentProcessor
io.micronaut.http.server.netty.jackson.JsonContentProcessor
- All Implemented Interfaces:
io.micronaut.core.util.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
-
Field Summary
Fields inherited from class io.micronaut.http.server.netty.AbstractHttpContentProcessor
advertisedLength, configuration, nettyHttpRequest, receivedLength, requestMaxSize -
Constructor Summary
ConstructorsConstructorDescriptionJsonContentProcessor(NettyHttpRequest<?> nettyHttpRequest, NettyHttpServerConfiguration configuration, io.micronaut.json.JsonMapper jsonMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete(Collection<Object> out) Finish processing data.protected voidonData(io.netty.buffer.ByteBufHolder message, Collection<Object> out) Called after verifying the data of the message.processSingle(io.netty.buffer.ByteBuf data) Process a singleByteBufinto a single item, if possible.resultType(io.micronaut.core.type.Argument<?> type) Set the type of the values returned by this processor.Methods inherited from class io.micronaut.http.server.netty.AbstractHttpContentProcessor
add, fireExceedsLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.server.netty.HttpContentProcessor
cancelMethods inherited from interface io.micronaut.core.util.Toggleable
isEnabled
-
Constructor Details
-
JsonContentProcessor
public JsonContentProcessor(NettyHttpRequest<?> nettyHttpRequest, NettyHttpServerConfiguration configuration, io.micronaut.json.JsonMapper jsonMapper) - Parameters:
nettyHttpRequest- The Netty Http requestconfiguration- The Http server configurationjsonMapper- The json codec
-
-
Method Details
-
resultType
Description copied from interface:HttpContentProcessorSet the type of the values returned by this processor. Most processors do not respect this setting, but e.g. theJsonContentProcessordoes.- Parameters:
type- The type produced by this processor- Returns:
- This processor, for chaining
-
processSingle
Description copied from interface:HttpContentProcessorProcess a singleByteBufinto a single item, if possible.- Parameters:
data- The input data- Returns:
- The output value, or
nullif 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:AbstractHttpContentProcessorCalled after verifying the data of the message.- Specified by:
onDatain classAbstractHttpContentProcessor- Parameters:
message- The messageout- The collection to add any produced messages to- Throws:
Throwable
-
complete
Description copied from interface:HttpContentProcessorFinish processing data.- Parameters:
out- The collection to add remaining output items to- Throws:
Throwable
-