-
- All Superinterfaces:
Flow.Subscriber<DataChunk>
public interface BareResponse extends Flow.Subscriber<DataChunk>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
backpressureStrategy(BackpressureStrategy backpressureStrategy)
Set the backpressure strategy used for requesting response data.void
onComplete()
Response should be flushed and closed.void
onError(Throwable thr)
Response should be flushed and closed.void
onNext(DataChunk data)
ProvidedByteBuffer
MUST be fully read during the method call.void
onSubscribe(Flow.Subscription subscription)
Each response is subscribed up to a single publisher and AFTERwriteStatusAndHeaders(Http.ResponseStatus, Map)
method is called and returned.long
requestId()
A unique correlation ID that is associated with this response and its associated request.Single<BareResponse>
whenCompleted()
Returns aSingle
of this response.Single<BareResponse>
whenHeadersCompleted()
Returns aSingle
of headers part of this response.void
writeStatusAndHeaders(Http.ResponseStatus status, Map<String,List<String>> headers)
Send response line and headers to the client.
-
-
-
Method Detail
-
writeStatusAndHeaders
void writeStatusAndHeaders(Http.ResponseStatus status, Map<String,List<String>> headers) throws SocketClosedException, NullPointerException
Send response line and headers to the client.- Parameters:
status
- an HTTP statusheaders
- a Map of header names and values- Throws:
SocketClosedException
- if headers were already send or response is closedNullPointerException
- ifstatus
isnull
-
whenHeadersCompleted
Single<BareResponse> whenHeadersCompleted()
Returns aSingle
of headers part of this response. The stage is completed when all headers are sent to the client.- Returns:
- a completion stage of the response.
-
whenCompleted
Single<BareResponse> whenCompleted()
Returns aSingle
of this response. The stage is completed when all response data are sent or response channel is finished.- Returns:
- a completion stage of the response.
-
backpressureStrategy
void backpressureStrategy(BackpressureStrategy backpressureStrategy)
Set the backpressure strategy used for requesting response data.- Parameters:
backpressureStrategy
- strategy used for requesting response data
-
onSubscribe
void onSubscribe(Flow.Subscription subscription)
Each response is subscribed up to a single publisher and AFTERwriteStatusAndHeaders(Http.ResponseStatus, Map)
method is called and returned.- Specified by:
onSubscribe
in interfaceFlow.Subscriber<DataChunk>
- Parameters:
subscription
- a subscription.
-
onNext
void onNext(DataChunk data) throws SocketClosedException
ProvidedByteBuffer
MUST be fully read during the method call.- Specified by:
onNext
in interfaceFlow.Subscriber<DataChunk>
- Parameters:
data
- chunk of the response payload- Throws:
SocketClosedException
- if response is already closed
-
onError
void onError(Throwable thr)
Response should be flushed and closed.This method can be called without a subscription or demand. HTTP IO must be able to handle it.
- Specified by:
onError
in interfaceFlow.Subscriber<DataChunk>
- Parameters:
thr
- an error.
-
onComplete
void onComplete()
Response should be flushed and closed.This method can be called without a subscription or demand. HTTP IO must be able to handle it.
- Specified by:
onComplete
in interfaceFlow.Subscriber<DataChunk>
-
requestId
long requestId()
A unique correlation ID that is associated with this response and its associated request.- Returns:
- a unique correlation ID associated with this response and its request
-
-