Class BufferingResponseListener
java.lang.Object
org.eclipse.jetty.client.AbstractResponseListener
org.eclipse.jetty.client.BufferingResponseListener
- All Implemented Interfaces:
EventListener
,Response.AsyncContentListener
,Response.BeginListener
,Response.CompleteListener
,Response.ContentListener
,Response.ContentSourceListener
,Response.FailureListener
,Response.HeaderListener
,Response.HeadersListener
,Response.Listener
,Response.ResponseListener
,Response.SuccessListener
Implementation of Response.Listener
that buffers the response content
by copying it up to a maximum length specified to the constructors.
The content may be retrieved from AbstractResponseListener.onSuccess(Response)
or Response.Listener.onComplete(Result)
via AbstractResponseListener.getContent()
or AbstractResponseListener.getContentAsString()
.
Instances of this class are not reusable, so one must be allocated for each request.
Use RetainingResponseListener
for a more efficient
implementation that does not copy the content bytes.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance with a default maximum length of 2 MiB.BufferingResponseListener
(int maxLength) Creates an instance with the given maximum length -
Method Summary
Methods inherited from class org.eclipse.jetty.client.AbstractResponseListener
getContent, getContentAsInputStream, getContentAsString, getContentAsString, getContentAsString, getEncoding, getMaxLength, getMediaType, onContent, onFailure, onHeaders, onSuccess
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.Listener
onBegin, onComplete, onContent, onHeader
-
Constructor Details
-
BufferingResponseListener
public BufferingResponseListener()Creates an instance with a default maximum length of 2 MiB. -
BufferingResponseListener
public BufferingResponseListener(int maxLength) Creates an instance with the given maximum length- Parameters:
maxLength
- the maximum length of the content
-