Package org.eclipse.jetty.proxy
Class ProxyHandler.ProxyResponseListener
java.lang.Object
java.util.concurrent.CompletableFuture<Void>
org.eclipse.jetty.util.Callback.Completable
org.eclipse.jetty.proxy.ProxyHandler.ProxyResponseListener
- All Implemented Interfaces:
CompletionStage<Void>
,Future<Void>
,EventListener
,Response.AsyncContentListener
,Response.BeginListener
,Response.CompleteListener
,Response.ContentListener
,Response.ContentSourceListener
,Response.FailureListener
,Response.HeaderListener
,Response.HeadersListener
,Response.Listener
,Response.ResponseListener
,Response.SuccessListener
,Callback
,Invocable
- Enclosing class:
- ProxyHandler
protected class ProxyHandler.ProxyResponseListener
extends Callback.Completable
implements Response.Listener
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Constructor Summary
ConstructorDescriptionProxyResponseListener
(Request clientToProxyRequest, Request proxyToServerRequest, Response proxyToClientResponse, Callback proxyToClientCallback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 serverToProxyResponse, Content.Chunk serverToProxyChunk, Runnable serverToProxyDemander) Callback method invoked when the response content has been received, parsed and there is demand.void
Callback method invoked when all the response headers have been received and parsed.void
Callback method invoked when the whole response has been successfully received.Methods inherited from class org.eclipse.jetty.util.Callback.Completable
compose, failed, from, getInvocationType, succeeded, with
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Callback
completeWith
Methods inherited from interface org.eclipse.jetty.client.Response.AsyncContentListener
onContentSource
Methods inherited from interface org.eclipse.jetty.client.Response.Listener
onContent, onFailure, onHeader
-
Constructor Details
-
ProxyResponseListener
-
-
Method Details
-
onBegin
Description copied from interface:Response.BeginListener
Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed.This method is the best approximation to detect when the first bytes of the response arrived to the client.
- Specified by:
onBegin
in interfaceResponse.BeginListener
- Specified by:
onBegin
in interfaceResponse.Listener
- Parameters:
serverToProxyResponse
- the response containing the response line data
-
onHeaders
Description copied from interface:Response.HeadersListener
Callback method invoked when all the response headers have been received and parsed.- Specified by:
onHeaders
in interfaceResponse.HeadersListener
- Specified by:
onHeaders
in interfaceResponse.Listener
- Parameters:
serverToProxyResponse
- the response containing the response line data and the headers
-
onContent
public void onContent(Response serverToProxyResponse, Content.Chunk serverToProxyChunk, Runnable serverToProxyDemander) Description copied from interface:Response.AsyncContentListener
Callback method invoked when the response content has been received, parsed and there is demand. Thechunk
must be consumed, copied, or retained before returning from this method as it is then automatically released. Thedemander
must be run before this method may be invoked again.- Specified by:
onContent
in interfaceResponse.AsyncContentListener
- Specified by:
onContent
in interfaceResponse.ContentListener
- Parameters:
serverToProxyResponse
- the response containing the response line data and the headersserverToProxyChunk
- the chunk receivedserverToProxyDemander
- the runnable to be run to demand the next chunk
-
onSuccess
Description copied from interface:Response.SuccessListener
Callback method invoked when the whole response has been successfully received.- Specified by:
onSuccess
in interfaceResponse.Listener
- Specified by:
onSuccess
in interfaceResponse.SuccessListener
- Parameters:
serverToProxyResponse
- the response containing the response line data and the headers
-
onComplete
Description copied from interface:Response.CompleteListener
Callback method invoked when the request and the response have been processed, either successfully or not.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)
orResponse.FailureListener.onFailure(Response, Throwable)
, and only when request indicates that it is completed.- Specified by:
onComplete
in interfaceResponse.CompleteListener
- Specified by:
onComplete
in interfaceResponse.Listener
- Parameters:
result
- the result of the request / response exchange
-