public interface RestResponseHandler
RestRequestService
and sent out via the
RestResponseChannel
with the RestResponseHandler forming a bridge between them to provide scaling
capabilities and non-blocking behaviour.
Implementations are expected to be thread-safe.Modifier and Type | Method and Description |
---|---|
void |
handleResponse(RestRequest restRequest,
RestResponseChannel restResponseChannel,
ReadableStreamChannel response,
java.lang.Exception exception)
Submit a response for a request along with a channel over which the response can be sent.
|
void |
shutdown()
Does shutdown tasks for the RestResponseHandler.
|
void |
start()
Does startup tasks for the RestResponseHandler.
|
void start() throws java.lang.InstantiationException
java.lang.InstantiationException
- if the RestResponseHandler is unable to start.void shutdown()
void handleResponse(RestRequest restRequest, RestResponseChannel restResponseChannel, ReadableStreamChannel response, java.lang.Exception exception) throws RestServiceException
exception
.
The bytes consumed from the response
are streamed out (unmodified) through the
restResponseChannel
.
Assumed that at least one of response
or exception
is null.
Depending on the implementation, it is possible that the response
is not immediately sent but en-queued to
be sent at a later time.restRequest
- the RestRequest
for which the response has been constructed.restResponseChannel
- the RestResponseChannel
to be used to send the response.response
- a ReadableStreamChannel
that represents the response to the restRequest
.exception
- if the response could not be constructed, the reason for the failure.RestServiceException
- if there is any error while processing the response.