Package org.eclipse.jetty.client
Class FutureResponseListener
java.lang.Object
org.eclipse.jetty.client.BufferingResponseListener
org.eclipse.jetty.client.FutureResponseListener
- All Implemented Interfaces:
Future<ContentResponse>
,EventListener
,Response.AsyncContentListener
,Response.BeginListener
,Response.CompleteListener
,Response.ContentListener
,Response.ContentSourceListener
,Response.FailureListener
,Response.HeaderListener
,Response.HeadersListener
,Response.Listener
,Response.ResponseListener
,Response.SuccessListener
@Deprecated
public class FutureResponseListener
extends BufferingResponseListener
implements Future<ContentResponse>
Deprecated.
A
BufferingResponseListener
that is also a Future
, to allow applications
to block (indefinitely or for a timeout) until onComplete(Result)
is called,
or to abort
the request/response conversation.
Typical usage is:
Request request = httpClient.newRequest(...)...; FutureResponseListener listener = new FutureResponseListener(request); request.send(listener); // Asynchronous send ContentResponse response = listener.get(5, TimeUnit.SECONDS); // Timed block
-
Constructor Summary
ConstructorDescriptionFutureResponseListener
(Request request) Deprecated.FutureResponseListener
(Request request, int maxLength) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel
(boolean mayInterruptIfRunning) Deprecated.get()
Deprecated.Deprecated.Deprecated.boolean
Deprecated.boolean
isDone()
Deprecated.void
onComplete
(Result result) Deprecated.Callback method invoked when the request and the response have been processed, either successfully or not.Methods inherited from class org.eclipse.jetty.client.BufferingResponseListener
getContent, getContentAsInputStream, getContentAsString, getContentAsString, getContentAsString, getEncoding, getMediaType, onContent, onHeaders
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.client.Response.AsyncContentListener
onContentSource
Methods inherited from interface org.eclipse.jetty.client.Response.ContentListener
onContent
Methods inherited from interface org.eclipse.jetty.client.Response.Listener
onBegin, onFailure, onHeader, onSuccess
-
Constructor Details
-
FutureResponseListener
Deprecated. -
FutureResponseListener
Deprecated.
-
-
Method Details
-
getRequest
Deprecated. -
onComplete
Deprecated.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
- Specified by:
onComplete
in classBufferingResponseListener
- Parameters:
result
- the result of the request / response exchange
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Deprecated.- Specified by:
cancel
in interfaceFuture<ContentResponse>
-
isCancelled
public boolean isCancelled()Deprecated.- Specified by:
isCancelled
in interfaceFuture<ContentResponse>
-
isDone
public boolean isDone()Deprecated.- Specified by:
isDone
in interfaceFuture<ContentResponse>
-
get
Deprecated.- Specified by:
get
in interfaceFuture<ContentResponse>
- Throws:
InterruptedException
ExecutionException
-
get
public ContentResponse get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Deprecated.- Specified by:
get
in interfaceFuture<ContentResponse>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
CompletableResponseListener
instead