Package io.micronaut.http.netty.stream
Class JsonSubscriber
java.lang.Object
io.micronaut.http.netty.stream.JsonSubscriber
- All Implemented Interfaces:
Subscriber<io.netty.handler.codec.http.HttpContent>
,reactor.core.CoreSubscriber<io.netty.handler.codec.http.HttpContent>
@Internal
public final class JsonSubscriber
extends Object
implements reactor.core.CoreSubscriber<io.netty.handler.codec.http.HttpContent>
A Reactor subscriber used to handle JSON content. It delegates to an upstream subscriber, wrapping them with opening/closing brackets
where necessary.
-
Constructor Summary
ConstructorDescriptionJsonSubscriber
(reactor.core.CoreSubscriber<? super io.netty.handler.codec.http.HttpContent> upstream) -
Method Summary
Modifier and TypeMethodDescriptionreactor.util.context.Context
static reactor.core.publisher.Flux<io.netty.handler.codec.http.HttpContent>
void
On complete the opening bracket should be emitted if no items were ever produced, then the closing bracket.void
void
onNext
(io.netty.handler.codec.http.HttpContent o) The goal is to prevent the emission of the opening bracket if the underlying stream never emits an item and only produces an error.void
-
Constructor Details
-
JsonSubscriber
public JsonSubscriber(reactor.core.CoreSubscriber<? super io.netty.handler.codec.http.HttpContent> upstream)
-
-
Method Details
-
currentContext
public reactor.util.context.Context currentContext()- Specified by:
currentContext
in interfacereactor.core.CoreSubscriber<io.netty.handler.codec.http.HttpContent>
-
onSubscribe
- Specified by:
onSubscribe
in interfacereactor.core.CoreSubscriber<io.netty.handler.codec.http.HttpContent>
- Specified by:
onSubscribe
in interfaceSubscriber<io.netty.handler.codec.http.HttpContent>
-
onNext
public void onNext(io.netty.handler.codec.http.HttpContent o) The goal is to prevent the emission of the opening bracket if the underlying stream never emits an item and only produces an error.- Specified by:
onNext
in interfaceSubscriber<io.netty.handler.codec.http.HttpContent>
- Parameters:
o
- The content
-
onError
- Specified by:
onError
in interfaceSubscriber<io.netty.handler.codec.http.HttpContent>
-
onComplete
public void onComplete()On complete the opening bracket should be emitted if no items were ever produced, then the closing bracket.- Specified by:
onComplete
in interfaceSubscriber<io.netty.handler.codec.http.HttpContent>
-
lift
public static reactor.core.publisher.Flux<io.netty.handler.codec.http.HttpContent> lift(Publisher<io.netty.handler.codec.http.HttpContent> publisher)
-