T - the result type produced by the wrapped AsyncHandler and emitted via RxJavapublic abstract class AbstractMaybeAsyncHandlerBridge<T> extends Object implements AsyncHandler<Void>
Maybe reactive base type and AsyncHandlers.
When an event is received, it's first checked if the Rx stream has been disposed asynchronously. If so, request
processing is aborted, otherwise, the event is forwarded to the wrapped handler.
When the request is completed, the result produced by the wrapped instance is
forwarded to the Maybe: If the result is null, MaybeEmitter.onComplete() is invoked,
MaybeEmitter.onSuccess(Object) otherwise.
Any errors during request processing are forwarded via MaybeEmitter.onError(Throwable).AsyncHandler.State| Modifier and Type | Field and Description |
|---|---|
protected io.reactivex.MaybeEmitter<T> |
emitter
The Rx callback object that receives downstream events and will be queried for its
disposed state when Async HTTP Client callbacks are invoked. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMaybeAsyncHandlerBridge(io.reactivex.MaybeEmitter<T> emitter) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract AsyncHandler<? extends T> |
delegate() |
protected AsyncHandler.State |
disposed()
Called to indicate that request processing is to be aborted because the linked Rx stream has been disposed.
|
AsyncHandler.State |
onBodyPartReceived(HttpResponseBodyPart content) |
Void |
onCompleted()
The value returned by the wrapped
AsyncHandler won't be returned by this method, but emtited via RxJava. |
AsyncHandler.State |
onHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) |
AsyncHandler.State |
onStatusReceived(HttpResponseStatus status) |
void |
onThrowable(Throwable t)
The exception will first be propagated to the wrapped
AsyncHandler, then emitted via RxJava. |
AsyncHandler.State |
onTrailingHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) |
protected final io.reactivex.MaybeEmitter<T> emitter
disposed state when Async HTTP Client callbacks are invoked.protected AbstractMaybeAsyncHandlerBridge(io.reactivex.MaybeEmitter<T> emitter)
public final AsyncHandler.State onBodyPartReceived(HttpResponseBodyPart content) throws Exception
onBodyPartReceived in interface AsyncHandler<Void>Exceptionpublic final AsyncHandler.State onStatusReceived(HttpResponseStatus status) throws Exception
onStatusReceived in interface AsyncHandler<Void>Exceptionpublic final AsyncHandler.State onHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) throws Exception
onHeadersReceived in interface AsyncHandler<Void>Exceptionpublic AsyncHandler.State onTrailingHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) throws Exception
onTrailingHeadersReceived in interface AsyncHandler<Void>Exceptionpublic final Void onCompleted()
The value returned by the wrapped AsyncHandler won't be returned by this method, but emtited via RxJava.
onCompleted in interface AsyncHandler<Void>nullpublic final void onThrowable(Throwable t)
The exception will first be propagated to the wrapped AsyncHandler, then emitted via RxJava. If the
invocation of the delegate itself throws an exception, both the original exception and the follow-up exception
will be wrapped into RxJava's CompositeException and then be emitted.
onThrowable in interface AsyncHandler<Void>protected final AsyncHandler.State disposed()
delegate didn't already receive a terminal event,
AsyncHandler#onThrowable(Throwable) onThrowable will be called with a DisposedException.State#ABORTprotected abstract AsyncHandler<? extends T> delegate()
AsyncHandler instance to which calls are delegatedCopyright © 2017. All Rights Reserved.