Class AbstractResponseListener
java.lang.Object
org.eclipse.jetty.client.AbstractResponseListener
- 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
- Direct Known Subclasses:
 BufferingResponseListener, RetainingResponseListener
- 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractResponseListener(RetainableByteBuffer.Mutable accumulator)  - 
Method Summary
Modifier and TypeMethodDescriptionbyte[]getContentAsString(String encoding) getContentAsString(Charset charset) longvoidonContent(Response response, ByteBuffer content) Callback method invoked when the response content has been received, parsed and there is demand.voidonContent(Response response, Content.Chunk chunk, Runnable demander) Callback method invoked when the response content has been received, parsed and there is demand.voidCallback method invoked when the response has failed in the process of being receivedvoidCallback method invoked when all the response headers have been received and parsed.voidCallback method invoked when the whole response has been successfully received.Methods 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
- 
AbstractResponseListener
 
 - 
 - 
Method Details
- 
getMaxLength
public long getMaxLength() - 
getEncoding
 - 
getMediaType
 - 
onHeaders
Description copied from interface:Response.HeadersListenerCallback method invoked when all the response headers have been received and parsed.- Specified by:
 onHeadersin interfaceResponse.HeadersListener- Specified by:
 onHeadersin interfaceResponse.Listener- Parameters:
 response- the response containing the response line data and the headers
 - 
onContent
Description copied from interface:Response.AsyncContentListenerCallback method invoked when the response content has been received, parsed and there is demand. Thechunkmust be consumed, copied, or retained before returning from this method as it is then automatically released. Thedemandermust be run before this method may be invoked again.- Specified by:
 onContentin interfaceResponse.AsyncContentListener- Specified by:
 onContentin interfaceResponse.ContentListener- Parameters:
 response- the response containing the response line data and the headerschunk- the chunk receiveddemander- the runnable to be run to demand the next chunk- Throws:
 Exception- an uncaught exception will abort the response, release the chunk and fail the content source from which the chunk was read from
 - 
onContent
Description copied from interface:Response.ContentListenerCallback method invoked when the response content has been received, parsed and there is demand. This method may be invoked multiple times, and thecontentbuffer must be consumed (or copied) before returning from this method. This method is also always invoked when content arrives as demand is automatically registered on return.- Specified by:
 onContentin interfaceResponse.ContentListener- Specified by:
 onContentin interfaceResponse.Listener- Parameters:
 response- the response containing the response line data and the headerscontent- the content bytes received
 - 
onSuccess
Description copied from interface:Response.SuccessListenerCallback method invoked when the whole response has been successfully received.- Specified by:
 onSuccessin interfaceResponse.Listener- Specified by:
 onSuccessin interfaceResponse.SuccessListener- Parameters:
 response- the response containing the response line data and the headers
 - 
onFailure
Description copied from interface:Response.FailureListenerCallback method invoked when the response has failed in the process of being received- Specified by:
 onFailurein interfaceResponse.FailureListener- Specified by:
 onFailurein interfaceResponse.Listener- Parameters:
 response- the response containing data up to the point the failure happenedfailure- the failure happened
 - 
getContent
public byte[] getContent()- Returns:
 - the content as a byte array.
 - See Also:
 
 - 
getContentAsString
- Returns:
 - the content as a string, using the "Content-Type" header to detect the encoding or defaulting to UTF-8 if the encoding could not be detected.
 - See Also:
 
 - 
getContentAsString
 - 
getContentAsString
 - 
getContentAsInputStream
- Returns:
 - the content as 
InputStream 
 
 -