com.ning.http.client.simple
Interface SimpleAHCTransferListener


public interface SimpleAHCTransferListener

A simple transfer listener for use with the SimpleAsyncHttpClient.

Note: This listener does not cover requests failing before a connection is established. For error handling, see SimpleAsyncHttpClient.Builder.setDefaultThrowableHandler(com.ning.http.client.ThrowableHandler)

Author:
Benjamin Hanzelmann

Method Summary
 void onBytesReceived(UriComponents uri, long amount, long current, long total)
          This method is called when bytes of the responses body are received.
 void onBytesSent(UriComponents uri, long amount, long current, long total)
          This method is called when bytes are sent.
 void onCompleted(UriComponents uri, int statusCode, String statusText)
          This method is called when the request is completed.
 void onHeaders(UriComponents uri, HeaderMap headers)
          This method is called after the response headers are received.
 void onStatus(UriComponents uri, int statusCode, String statusText)
          This method is called after the connection status is received.
 

Method Detail

onStatus

void onStatus(UriComponents uri,
              int statusCode,
              String statusText)
This method is called after the connection status is received.

Parameters:
url - the url for the connection.
statusCode - the received status code.
statusText - the received status text.

onHeaders

void onHeaders(UriComponents uri,
               HeaderMap headers)
This method is called after the response headers are received.

Parameters:
uri - the uri
headers - the received headers, never null.

onBytesReceived

void onBytesReceived(UriComponents uri,
                     long amount,
                     long current,
                     long total)
This method is called when bytes of the responses body are received.

Parameters:
uri - the uri
amount - the number of transferred bytes so far.
current - the number of transferred bytes since the last call to this method.
total - the total number of bytes to be transferred. This is taken from the Content-Length-header and may be unspecified (-1).

onBytesSent

void onBytesSent(UriComponents uri,
                 long amount,
                 long current,
                 long total)
This method is called when bytes are sent.

Parameters:
uri - the uri
amount - the number of transferred bytes so far.
current - the number of transferred bytes since the last call to this method.
total - the total number of bytes to be transferred. This is taken from the Content-Length-header and may be unspecified (-1).

onCompleted

void onCompleted(UriComponents uri,
                 int statusCode,
                 String statusText)
This method is called when the request is completed.

Parameters:
uri - the uri
statusCode - the received status code.
statusText - the received status text.


Copyright © 2014. All Rights Reserved.