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 AbstractResponseListener
getContent, getContentAsInputStream, getContentAsString, getContentAsString, getContentAsString, getEncoding, getMaxLength, getMediaType, onContent, onContent, onFailure, onHeaders, onSuccessMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Response.AsyncContentListener
onContentSourceMethods inherited from interface Response.Listener
onBegin, onComplete, 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
 
 -