public class DefaultHttpResponse extends DefaultStreamMessage<HttpObject> implements HttpResponse, HttpResponseWriter
HttpResponse
instance.Constructor and Description |
---|
DefaultHttpResponse() |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
completionFuture()
Returns a
CompletableFuture that completes when this stream is complete,
either successfully or exceptionally, including cancellation and abortion. |
protected EventExecutor |
defaultSubscriberExecutor()
Returns the default
EventExecutor which will be used when a user subscribes using
subscribe(Subscriber) or subscribe(Subscriber, boolean) . |
CompletableFuture<Void> |
onDemand(Runnable task)
Performs the specified
task when there's enough demans from the Subscriber . |
protected void |
onRemoval(T obj)
Invoked after an element is removed from the
StreamMessage and before
Subscriber.onNext(Object) is invoked. |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
Requests to start streaming data to the specified
Subscriber . |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber,
boolean withPooledObjects)
Requests to start streaming data to the specified
Subscriber . |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber,
EventExecutor executor)
Requests to start streaming data, invoking the specified
Subscriber from the specified
Executor . |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber,
EventExecutor executor,
boolean withPooledObjects)
Requests to start streaming data, invoking the specified
Subscriber from the specified
Executor . |
String |
toString() |
boolean |
write(T obj)
Writes the specified object to the
StreamMessage . |
abort, close, close, isEmpty, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
aggregate, aggregate, closeFuture, completionFuture, from, of, of, of, of, of, of, of, of, of, ofFailed, ofFailure
abort, isComplete, isEmpty, isOpen, subscribe, subscribe, subscribe, subscribe
public boolean write(T obj)
StreamWriter
StreamMessage
. The written object will be transferred to the
Subscriber
.true
if the specified object has been scheduled for publication. false
if the
stream has been closed already.public CompletableFuture<Void> onDemand(Runnable task)
StreamWriter
task
when there's enough demans from the Subscriber
.task
finishes or
exceptionally when the StreamMessage
is closed unexpectedly.public final void subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
StreamMessage
Subscriber
. If there is a problem subscribing,
Subscriber.onError(Throwable)
will be invoked with one of the following exceptions:
IllegalStateException
if other Subscriber
subscribed to this stream alreadyAbortedStreamException
if this stream has been aborted.subscribe
in interface StreamMessage<T>
subscribe
in interface org.reactivestreams.Publisher<T>
public final void subscribe(org.reactivestreams.Subscriber<? super T> subscriber, boolean withPooledObjects)
StreamMessage
Subscriber
. If there is a problem subscribing,
Subscriber.onError(Throwable)
will be invoked with one of the following exceptions:
IllegalStateException
if other Subscriber
subscribed to this stream alreadyAbortedStreamException
if this stream has been aborted.subscribe
in interface StreamMessage<T>
withPooledObjects
- if true
, receives the pooled ByteBuf
and ByteBufHolder
as is, without making a copy. If you don't know what this means, use
StreamMessage.subscribe(Subscriber)
.public final void subscribe(org.reactivestreams.Subscriber<? super T> subscriber, EventExecutor executor)
StreamMessage
Subscriber
from the specified
Executor
. If there is a problem subscribing, Subscriber.onError(Throwable)
will be
invoked with one of the following exceptions:
IllegalStateException
if other Subscriber
subscribed to this stream alreadyAbortedStreamException
if this stream has been aborted.subscribe
in interface StreamMessage<T>
public final void subscribe(org.reactivestreams.Subscriber<? super T> subscriber, EventExecutor executor, boolean withPooledObjects)
StreamMessage
Subscriber
from the specified
Executor
. If there is a problem subscribing, Subscriber.onError(Throwable)
will be
invoked with one of the following exceptions:
IllegalStateException
if other Subscriber
subscribed to this stream alreadyAbortedStreamException
if this stream has been aborted.subscribe
in interface StreamMessage<T>
withPooledObjects
- if true
, receives the pooled ByteBuf
and ByteBufHolder
as is, without making a copy. If you don't know what this means, use
StreamMessage.subscribe(Subscriber)
.protected EventExecutor defaultSubscriberExecutor()
EventExecutor
which will be used when a user subscribes using
subscribe(Subscriber)
or subscribe(Subscriber, boolean)
.public final CompletableFuture<Void> completionFuture()
StreamMessage
CompletableFuture
that completes when this stream is complete,
either successfully or exceptionally, including cancellation and abortion.
A StreamMessage
is complete
(or 'fully consumed') when:
Subscriber
consumes all elements and Subscriber.onComplete()
is invoked,Subscriber.onError(Throwable)
is invoked,Subscription
has been cancelled orStreamMessage.abort()
has been requested.completionFuture
in interface StreamMessage<T>
protected void onRemoval(T obj)
StreamMessage
and before
Subscriber.onNext(Object)
is invoked.obj
- the removed element© Copyright 2015–2017 LINE Corporation. All rights reserved.