Build 1.0_r1(from source)

android.net.http
Interface EventHandler

All Known Implementing Classes:
LoadListener, LoggingEventHandler

public interface EventHandler

Callbacks in this interface are made as an HTTP request is processed. The normal order of callbacks is status(), headers(), then multiple data() then endData(). handleSslErrorRequest(), if there is an SSL certificate error. error() can occur anywhere in the transaction.


Field Summary
static int ERROR
          Generic error
static int ERROR_AUTH
          User authentication failed on server
static int ERROR_BAD_URL
          Bad URL
static int ERROR_CONNECT
          Could not connect to server
static int ERROR_FAILED_SSL_HANDSHAKE
          Failed to perform SSL handshake
static int ERROR_IO
          Failed to write to or read from server
static int ERROR_LOOKUP
          Server or proxy hostname lookup failed
static int ERROR_PROXYAUTH
          User authentication failed on proxy
static int ERROR_REDIRECT_LOOP
          Too many redirects
static int ERROR_TIMEOUT
          Connection timed out
static int ERROR_UNSUPPORTED_AUTH_SCHEME
          Unsupported authentication scheme (ie, not basic or digest)
static int ERROR_UNSUPPORTED_SCHEME
          Unsupported URI scheme (ie, not http, https, etc)
static int[] errorStringResources
           
static int FILE_ERROR
          Generic file error for file:/// loads
static int FILE_NOT_FOUND_ERROR
          File not found error for file:/// loads
static int OK
          Success
static int TOO_MANY_REQUESTS_ERROR
          Too many requests queued
 
Method Summary
 void certificate(SslCertificate certificate)
          SSL certificate callback called every time a resource is loaded via a secure connection
 void data(byte[] data, int len)
          An array containing all or part of the http body as read from the server.
 void endData()
          Called when the document is completely read.
 void error(int id, String description)
          There was trouble.
 void handleSslErrorRequest(SslError error)
          SSL certificate error callback.
 void headers(Headers headers)
          Called after all headers are successfully processed.
 void status(int major_version, int minor_version, int code, String reason_phrase)
          Called after status line has been sucessfully processed.
 

Field Detail

OK

static final int OK
Success

See Also:
Constant Field Values

ERROR

static final int ERROR
Generic error

See Also:
Constant Field Values

ERROR_LOOKUP

static final int ERROR_LOOKUP
Server or proxy hostname lookup failed

See Also:
Constant Field Values

ERROR_UNSUPPORTED_AUTH_SCHEME

static final int ERROR_UNSUPPORTED_AUTH_SCHEME
Unsupported authentication scheme (ie, not basic or digest)

See Also:
Constant Field Values

ERROR_AUTH

static final int ERROR_AUTH
User authentication failed on server

See Also:
Constant Field Values

ERROR_PROXYAUTH

static final int ERROR_PROXYAUTH
User authentication failed on proxy

See Also:
Constant Field Values

ERROR_CONNECT

static final int ERROR_CONNECT
Could not connect to server

See Also:
Constant Field Values

ERROR_IO

static final int ERROR_IO
Failed to write to or read from server

See Also:
Constant Field Values

ERROR_TIMEOUT

static final int ERROR_TIMEOUT
Connection timed out

See Also:
Constant Field Values

ERROR_REDIRECT_LOOP

static final int ERROR_REDIRECT_LOOP
Too many redirects

See Also:
Constant Field Values

ERROR_UNSUPPORTED_SCHEME

static final int ERROR_UNSUPPORTED_SCHEME
Unsupported URI scheme (ie, not http, https, etc)

See Also:
Constant Field Values

ERROR_FAILED_SSL_HANDSHAKE

static final int ERROR_FAILED_SSL_HANDSHAKE
Failed to perform SSL handshake

See Also:
Constant Field Values

ERROR_BAD_URL

static final int ERROR_BAD_URL
Bad URL

See Also:
Constant Field Values

FILE_ERROR

static final int FILE_ERROR
Generic file error for file:/// loads

See Also:
Constant Field Values

FILE_NOT_FOUND_ERROR

static final int FILE_NOT_FOUND_ERROR
File not found error for file:/// loads

See Also:
Constant Field Values

TOO_MANY_REQUESTS_ERROR

static final int TOO_MANY_REQUESTS_ERROR
Too many requests queued

See Also:
Constant Field Values

errorStringResources

static final int[] errorStringResources
Method Detail

status

void status(int major_version,
            int minor_version,
            int code,
            String reason_phrase)
Called after status line has been sucessfully processed.

Parameters:
major_version - HTTP version advertised by server. major is the part before the "."
minor_version - HTTP version advertised by server. minor is the part after the "."
code - HTTP Status code. See RFC 2616.
reason_phrase - Textual explanation sent by server

headers

void headers(Headers headers)
Called after all headers are successfully processed.


data

void data(byte[] data,
          int len)
An array containing all or part of the http body as read from the server.

Parameters:
data - A byte array containing the content
len - The length of valid content in data Note: chunked and compressed encodings are handled within android.net.http. Decoded data is passed through this interface.

endData

void endData()
Called when the document is completely read. No more data() callbacks will be made after this call


certificate

void certificate(SslCertificate certificate)
SSL certificate callback called every time a resource is loaded via a secure connection


error

void error(int id,
           String description)
There was trouble.

Parameters:
id - One of the error codes defined below
description - of error

handleSslErrorRequest

void handleSslErrorRequest(SslError error)
SSL certificate error callback. Handles SSL error(s) on the way up to the user. The callback has to make sure that restartConnection() is called, otherwise the connection will be suspended indefinitely.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature