T
- response message representation.public abstract class AbstractAsyncPushHandler<T> extends Object implements AsyncPushConsumer
Constructor and Description |
---|
AbstractAsyncPushHandler(AsyncResponseConsumer<T> responseConsumer) |
Modifier and Type | Method and Description |
---|---|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
void |
consumePromise(HttpRequest promise,
HttpResponse response,
EntityDetails entityDetails,
HttpContext httpContext)
Triggered to signal receipt of a request message head used as a promise
and the corresponding pushed response.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
protected void |
handleError(HttpRequest promise,
Exception cause)
Triggered to handle the exception thrown while processing a push response.
|
protected abstract void |
handleResponse(HttpRequest promise,
T responseMessage)
Triggered to handle the push message with the given promised request.
|
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers)
Triggered to signal termination of the data stream.
|
void |
updateCapacity(CapacityChannel capacityChannel)
Triggered to signal ability of the underlying data stream to receive
data capacity update.
|
public AbstractAsyncPushHandler(AsyncResponseConsumer<T> responseConsumer)
protected abstract void handleResponse(HttpRequest promise, T responseMessage) throws IOException, HttpException
promise
- the promised request message.responseMessage
- the pushed response message.IOException
- in case of an I/O error.HttpException
- in case of an HTTP protocol violation.protected void handleError(HttpRequest promise, Exception cause)
promise
- the promised request message.cause
- the cause of error.public final void consumePromise(HttpRequest promise, HttpResponse response, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException
AsyncPushConsumer
consumePromise
in interface AsyncPushConsumer
promise
- the request message head used as a promise.response
- the pushed response message.entityDetails
- the response entity details or null
if the response
does not enclose an entity.httpContext
- the actual execution context.HttpException
- in case of an HTTP protocol violation.IOException
- in case of an I/O error.public final void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumer
updateCapacity
in interface AsyncDataConsumer
capacityChannel
- the channel for capacity updates.IOException
- in case of an I/O error.public final void consume(ByteBuffer src) throws IOException
AsyncDataConsumer
consume
in interface AsyncDataConsumer
src
- data source.IOException
- in case of an I/O error.public final void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumer
streamEnd
in interface AsyncDataConsumer
trailers
- data stream trailers.HttpException
- in case of an HTTP protocol violation.IOException
- in case of an I/O error.public final void failed(Exception cause)
AsyncPushConsumer
failed
in interface AsyncPushConsumer
cause
- the cause of the failure.public final void releaseResources()
releaseResources
in interface ResourceHolder
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.