protected class AsyncMiddleManServlet.ProxyResponseListener extends Response.Listener.Adapter implements Callback
Callback.Completable, Callback.Nested
Invocable.InvocationType
Response.Listener.Adapter
__nonBlocking
Modifier | Constructor and Description |
---|---|
protected |
ProxyResponseListener(HttpServletRequest clientRequest,
HttpServletResponse proxyResponse) |
Modifier and Type | Method and Description |
---|---|
void |
failed(Throwable failure)
Callback invoked when the operation fails.
|
void |
onBegin(Response serverResponse)
Callback method invoked when the response line containing HTTP version,
HTTP status code and reason has been received and parsed.
|
void |
onComplete(Result result)
Callback method invoked when the request and the response have been processed,
either successfully or not.
|
void |
onContent(Response serverResponse,
ByteBuffer content,
Callback callback)
Callback method invoked asynchronously when the response content has been received.
|
void |
onHeaders(Response serverResponse)
Callback method invoked when the response headers have been received and parsed.
|
void |
onSuccess(Response serverResponse)
Callback method invoked when the whole response has been successfully received.
|
void |
succeeded()
Callback invoked when the operation completes.
|
onContent, onFailure, onHeader
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asPreferred, getInvocationType, getInvocationType, invokeNonBlocking, invokePreferNonBlocking, invokePreferred, isNonBlockingInvocation
protected ProxyResponseListener(HttpServletRequest clientRequest, HttpServletResponse proxyResponse)
public void onBegin(Response serverResponse)
Response.BeginListener
This method is the best approximation to detect when the first bytes of the response arrived to the client.
onBegin
in interface Response.BeginListener
onBegin
in class Response.Listener.Adapter
serverResponse
- the response containing the response line datapublic void onHeaders(Response serverResponse)
Response.HeadersListener
onHeaders
in interface Response.HeadersListener
onHeaders
in class Response.Listener.Adapter
serverResponse
- the response containing the response line data and the headerspublic void onContent(Response serverResponse, ByteBuffer content, Callback callback)
Response.AsyncContentListener
onContent
in interface Response.AsyncContentListener
onContent
in class Response.Listener.Adapter
serverResponse
- the response containing the response line data and the headerscontent
- the content bytes receivedcallback
- the callback to call when the content is consumed.public void onSuccess(Response serverResponse)
Response.SuccessListener
onSuccess
in interface Response.SuccessListener
onSuccess
in class Response.Listener.Adapter
serverResponse
- the response containing the response line data and the headerspublic void onComplete(Result result)
Response.CompleteListener
The result
parameter contains the request, the response, and eventual failures.
Requests may complete after response, for example in case of big uploads that are
discarded or read asynchronously by the server.
This method is always invoked after Response.SuccessListener.onSuccess(Response)
or
Response.FailureListener.onFailure(Response, Throwable)
, and only when request indicates that
it is completed.
onComplete
in interface Response.CompleteListener
onComplete
in class Response.Listener.Adapter
result
- the result of the request / response exchangepublic void succeeded()
Callback
Callback invoked when the operation completes.
succeeded
in interface Callback
Callback.failed(Throwable)
Copyright © 1995–2017 Webtide. All rights reserved.