protected class AsyncMiddleManServlet.ProxyResponseListener extends Response.Listener.Adapter implements Callback
Callback.Completable, Callback.NestedInvocable.InvocationTypeResponse.Listener.Adapter| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.nio.ByteBuffer> |
buffers |
private javax.servlet.http.HttpServletRequest |
clientRequest |
private Callback |
complete |
private long |
contentLength |
private boolean |
hasContent |
private long |
length |
private javax.servlet.http.HttpServletResponse |
proxyResponse |
private Response |
response |
private java.lang.String |
WRITE_LISTENER_ATTRIBUTE |
__nonBlocking| Modifier | Constructor and Description |
|---|---|
protected |
ProxyResponseListener(javax.servlet.http.HttpServletRequest clientRequest,
javax.servlet.http.HttpServletResponse proxyResponse) |
| Modifier and Type | Method and Description |
|---|---|
void |
failed(java.lang.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,
java.nio.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, onHeaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInvocationType, getInvocationType, invokeNonBlocking, isNonBlockingInvocationprivate final java.lang.String WRITE_LISTENER_ATTRIBUTE
private final Callback complete
private final java.util.List<java.nio.ByteBuffer> buffers
private final javax.servlet.http.HttpServletRequest clientRequest
private final javax.servlet.http.HttpServletResponse proxyResponse
private boolean hasContent
private long contentLength
private long length
private Response response
protected ProxyResponseListener(javax.servlet.http.HttpServletRequest clientRequest,
javax.servlet.http.HttpServletResponse proxyResponse)
public void onBegin(Response serverResponse)
Response.BeginListenerThis method is the best approximation to detect when the first bytes of the response arrived to the client.
onBegin in interface Response.BeginListeneronBegin in class Response.Listener.AdapterserverResponse - the response containing the response line datapublic void onHeaders(Response serverResponse)
Response.HeadersListeneronHeaders in interface Response.HeadersListeneronHeaders in class Response.Listener.AdapterserverResponse - the response containing the response line data and the headerspublic void onContent(Response serverResponse, java.nio.ByteBuffer content, Callback callback)
Response.AsyncContentListeneronContent in interface Response.AsyncContentListeneronContent in class Response.Listener.AdapterserverResponse - 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.SuccessListeneronSuccess in interface Response.SuccessListeneronSuccess in class Response.Listener.AdapterserverResponse - 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.CompleteListeneronComplete in class Response.Listener.Adapterresult - the result of the request / response exchangepublic void succeeded()
CallbackCallback invoked when the operation completes.
succeeded in interface CallbackCallback.failed(Throwable)