Package org.eclipse.jetty.client.api
Class Response.Listener.Adapter
- java.lang.Object
-
- org.eclipse.jetty.client.api.Response.Listener.Adapter
-
- All Implemented Interfaces:
java.util.EventListener
,Response.AsyncContentListener
,Response.BeginListener
,Response.CompleteListener
,Response.ContentListener
,Response.DemandedContentListener
,Response.FailureListener
,Response.HeaderListener
,Response.HeadersListener
,Response.Listener
,Response.ResponseListener
,Response.SuccessListener
- Direct Known Subclasses:
AsyncMiddleManServlet.ProxyResponseListener
,BufferingResponseListener
,InputStreamResponseListener
,ProxyServlet.ProxyResponseListener
,RedirectProtocolHandler
- Enclosing interface:
- Response.Listener
public static class Response.Listener.Adapter extends java.lang.Object implements Response.Listener
An empty implementation ofResponse.Listener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.Response.Listener
Response.Listener.Adapter
-
-
Constructor Summary
Constructors Constructor Description Adapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onBegin(Response response)
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 response, java.nio.ByteBuffer content)
Callback method invoked when the response content has been received, parsed and there is demand.void
onContent(Response response, java.nio.ByteBuffer content, Callback callback)
Callback method invoked when the response content has been received, parsed and there is demand.void
onContent(Response response, java.util.function.LongConsumer demand, java.nio.ByteBuffer content, Callback callback)
Callback method invoked when the response content has been received.void
onFailure(Response response, java.lang.Throwable failure)
Callback method invoked when the response has failed in the process of being receivedboolean
onHeader(Response response, HttpField field)
Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.void
onHeaders(Response response)
Callback method invoked when all the response headers have been received and parsed.void
onSuccess(Response response)
Callback method invoked when the whole response has been successfully received.-
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.api.Response.DemandedContentListener
onBeforeContent
-
-
-
-
Method Detail
-
onBegin
public void onBegin(Response response)
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
- Parameters:
response
- the response containing the response line data
-
onHeader
public boolean onHeader(Response response, HttpField field)
Description copied from interface:Response.HeaderListener
Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.- Specified by:
onHeader
in interfaceResponse.HeaderListener
- Parameters:
response
- the response containing the response line data and the headers so farfield
- the header received- Returns:
- true to process the header, false to skip processing of the header
-
onHeaders
public void onHeaders(Response response)
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
- Parameters:
response
- the response containing the response line data and the headers
-
onContent
public void onContent(Response response, java.nio.ByteBuffer content)
Description copied from interface:Response.ContentListener
Callback method invoked when the response content has been received, parsed and there is demand. This method may be invoked multiple times, and thecontent
buffer must be consumed (or copied) before returning from this method.- Specified by:
onContent
in interfaceResponse.ContentListener
- Parameters:
response
- the response containing the response line data and the headerscontent
- the content bytes received
-
onContent
public void onContent(Response response, java.nio.ByteBuffer content, Callback callback)
Description copied from interface:Response.AsyncContentListener
Callback method invoked when the response content has been received, parsed and there is demand. Thecallback
object should be succeeded to signal that thecontent
buffer has been consumed and to demand more content.- Specified by:
onContent
in interfaceResponse.AsyncContentListener
- Parameters:
response
- the response containing the response line data and the headerscontent
- the content bytes receivedcallback
- the callback to call when the content is consumed and to demand more content
-
onContent
public void onContent(Response response, java.util.function.LongConsumer demand, java.nio.ByteBuffer content, Callback callback)
Description copied from interface:Response.DemandedContentListener
Callback method invoked when the response content has been received. Thecallback
object should be succeeded to signal that thecontent
buffer has been consumed. Thedemand
object should be used to demand more content, similarly to ReactiveStreams'sSubscription#request(long)
.- Specified by:
onContent
in interfaceResponse.DemandedContentListener
- Parameters:
response
- the response containing the response line data and the headersdemand
- the object that allows to demand content bufferscontent
- the content bytes receivedcallback
- the callback to call when the content is consumed
-
onSuccess
public void onSuccess(Response response)
Description copied from interface:Response.SuccessListener
Callback method invoked when the whole response has been successfully received.- Specified by:
onSuccess
in interfaceResponse.SuccessListener
- Parameters:
response
- the response containing the response line data and the headers
-
onFailure
public void onFailure(Response response, java.lang.Throwable failure)
Description copied from interface:Response.FailureListener
Callback method invoked when the response has failed in the process of being received- Specified by:
onFailure
in interfaceResponse.FailureListener
- Parameters:
response
- the response containing data up to the point the failure happenedfailure
- the failure happened
-
onComplete
public void onComplete(Result result)
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
- Parameters:
result
- the result of the request / response exchange
-
-