FileDocCategorySizeDatePackage
EventHandler.javaAPI DocAndroid 1.5 API5569Wed May 06 22:41:56 BST 2009android.net.http

EventHandler

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. {@hide}

Fields Summary
public static final int
OK
Success
public static final int
ERROR
Generic error
public static final int
ERROR_LOOKUP
Server or proxy hostname lookup failed
public static final int
ERROR_UNSUPPORTED_AUTH_SCHEME
Unsupported authentication scheme (ie, not basic or digest)
public static final int
ERROR_AUTH
User authentication failed on server
public static final int
ERROR_PROXYAUTH
User authentication failed on proxy
public static final int
ERROR_CONNECT
Could not connect to server
public static final int
ERROR_IO
Failed to write to or read from server
public static final int
ERROR_TIMEOUT
Connection timed out
public static final int
ERROR_REDIRECT_LOOP
Too many redirects
public static final int
ERROR_UNSUPPORTED_SCHEME
Unsupported URI scheme (ie, not http, https, etc)
public static final int
ERROR_FAILED_SSL_HANDSHAKE
Failed to perform SSL handshake
public static final int
ERROR_BAD_URL
Bad URL
public static final int
FILE_ERROR
Generic file error for file:/// loads
public static final int
FILE_NOT_FOUND_ERROR
File not found error for file:/// loads
public static final int
TOO_MANY_REQUESTS_ERROR
Too many requests queued
static final int[]
errorStringResources
Constructors Summary
Methods Summary
public voidcertificate(SslCertificate certificate)
SSL certificate callback called every time a resource is loaded via a secure connection

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

param
data A byte array containing the content
param
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.

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

public voiderror(int id, java.lang.String description)
There was trouble.

param
id One of the error codes defined below
param
description of error

public voidhandleSslErrorRequest(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.

public voidheaders(Headers headers)
Called after all headers are successfully processed.

public voidstatus(int major_version, int minor_version, int code, java.lang.String reason_phrase)
Called after status line has been sucessfully processed.

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