Build 1.0_r1(from source)

android.webkit
Class LoadListener

java.lang.Object
  extended by android.os.Handler
      extended by android.webkit.LoadListener
All Implemented Interfaces:
EventHandler

 class LoadListener
extends Handler
implements EventHandler


Field Summary
 long mContentLength
           
 
Fields inherited from interface android.net.http.EventHandler
ERROR, ERROR_AUTH, ERROR_BAD_URL, ERROR_CONNECT, ERROR_FAILED_SSL_HANDSHAKE, ERROR_IO, ERROR_LOOKUP, ERROR_PROXYAUTH, ERROR_REDIRECT_LOOP, ERROR_TIMEOUT, ERROR_UNSUPPORTED_AUTH_SCHEME, ERROR_UNSUPPORTED_SCHEME, errorStringResources, FILE_ERROR, FILE_NOT_FOUND_ERROR, OK, TOO_MANY_REQUESTS_ERROR
 
Constructor Summary
LoadListener(Context context, BrowserFrame frame, String url, int nativeLoader, boolean synchronous, boolean isMainPageLoader)
           
 
Method Summary
(package private)  void attachRequestHandle(RequestHandle requestHandle)
           
(package private)  boolean authCredentialsInvalid()
          Returns true iff an HTTP authentication problem has occured (credentials invalid).
 void cancel()
          Cancel a request.
 boolean cancelled()
           
 void certificate(SslCertificate certificate)
          Implementation of certificate handler for EventHandler.
(package private)  boolean checkCache(Map<String,String> headers)
          Check the cache for the current URL, and load it if it is valid.
(package private)  long contentLength()
           
 void data(byte[] data, int length)
          Add data to the internal collection of data.
(package private)  void detachRequestHandle()
           
(package private)  void downloadFile()
           
 void endData()
          Event handler's endData call.
 void error(int id, String description)
          Implementation of error handler for EventHandler.
(package private)  Context getContext()
           
(package private)  BrowserFrame getFrame()
           
static LoadListener getLoadListener(Context context, BrowserFrame frame, String url, int nativeLoader, boolean synchronous, boolean isMainPageLoader)
           
static int getNativeLoaderCount()
           
(package private)  WebAddress getWebAddress()
           
(package private)  void handleAuthResponse(String username, String password)
          Uses user-supplied credentials to restar a request.
 void handleMessage(Message msg)
          Subclasses must implement this to receive messages.
 void handleSslErrorRequest(SslError error)
          SSL certificate error callback.
(package private)  void handleSslErrorResponse(boolean proceed)
          Handles SSL error(s) on the way down from the user (the user has already provided their feedback).
 void headers(Headers headers)
          Parse the headers sent from the server.
(package private)  String host()
           
(package private)  boolean isSynchronous()
           
(package private)  void loadSynchronousMessages()
          Cycle through our messages for synchronous loads.
(package private)  String mimeType()
           
(package private)  void notifyError()
          Notify the loader we encountered an error.
(package private)  String originalUrl()
           
(package private)  boolean proxyAuthenticate()
           
(package private)  String realm()
           
(package private)  void resetCancel()
           
(package private)  void setCacheLoader(CacheLoader result)
          Set the CacheLoader for the case where we might want to load from cache
(package private)  void setRequestData(String method, Map<String,String> headers, String postData, boolean isHighPriority)
          This is called when a request can be satisfied by the cache, however, the cache result could be a redirect.
(package private)  void setUrl(String url)
          Sets the current URL associated with this load.
(package private)  SslError sslError()
           
 void status(int majorVersion, int minorVersion, int code, String reasonPhrase)
          Report the status of the response.
(package private)  void tearDown()
          Tear down the load.
(package private)  String url()
           
(package private) static boolean willLoadFromCache(String url)
           
 
Methods inherited from class android.os.Handler
dispatchMessage, dump, getLooper, hasMessages, hasMessages, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, post, postAtFrontOfQueue, postAtTime, postAtTime, postDelayed, removeCallbacks, removeCallbacks, removeCallbacksAndMessages, removeMessages, removeMessages, sendEmptyMessage, sendEmptyMessageAtTime, sendEmptyMessageDelayed, sendMessage, sendMessageAtFrontOfQueue, sendMessageAtTime, sendMessageDelayed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mContentLength

public long mContentLength
Constructor Detail

LoadListener

LoadListener(Context context,
             BrowserFrame frame,
             String url,
             int nativeLoader,
             boolean synchronous,
             boolean isMainPageLoader)
Method Detail

getLoadListener

public static LoadListener getLoadListener(Context context,
                                           BrowserFrame frame,
                                           String url,
                                           int nativeLoader,
                                           boolean synchronous,
                                           boolean isMainPageLoader)

getNativeLoaderCount

public static int getNativeLoaderCount()

handleMessage

public void handleMessage(Message msg)
Description copied from class: Handler
Subclasses must implement this to receive messages.

Overrides:
handleMessage in class Handler

getFrame

BrowserFrame getFrame()
Returns:
The loader's BrowserFrame.

getContext

Context getContext()

isSynchronous

boolean isSynchronous()

cancelled

public boolean cancelled()
Returns:
True iff the load has been cancelled

headers

public void headers(Headers headers)
Parse the headers sent from the server.

Specified by:
headers in interface EventHandler
Parameters:
headers - gives up the HeaderGroup IMPORTANT: as this is called from network thread, can't call native directly

proxyAuthenticate

boolean proxyAuthenticate()
Returns:
True iff this loader is in the proxy-authenticate state.

status

public void status(int majorVersion,
                   int minorVersion,
                   int code,
                   String reasonPhrase)
Report the status of the response. TODO: Comments about each parameter. IMPORTANT: as this is called from network thread, can't call native directly

Specified by:
status in interface EventHandler
Parameters:
majorVersion - HTTP version advertised by server. major is the part before the "."
minorVersion - HTTP version advertised by server. minor is the part after the "."
code - HTTP Status code. See RFC 2616.
reasonPhrase - Textual explanation sent by server

certificate

public void certificate(SslCertificate certificate)
Implementation of certificate handler for EventHandler. Called every time a resource is loaded via a secure connection. In this context, can be called multiple times if we have redirects

Specified by:
certificate in interface EventHandler
Parameters:
certificate - The SSL certifcate

error

public void error(int id,
                  String description)
Implementation of error handler for EventHandler. Subclasses should call this method to have error fields set.

Specified by:
error in interface EventHandler
Parameters:
id - The error id described by EventHandler.
description - A string description of the error. IMPORTANT: as this is called from network thread, can't call native directly

data

public void data(byte[] data,
                 int length)
Add data to the internal collection of data. This function is used by the data: scheme, about: scheme and http/https schemes.

Specified by:
data in interface EventHandler
Parameters:
data - A byte array containing the content.
length - The length of data. IMPORTANT: as this is called from network thread, can't call native directly

endData

public void endData()
Event handler's endData call. Send a message to the handler notifying them that the data has finished. IMPORTANT: as this is called from network thread, can't call native directly

Specified by:
endData in interface EventHandler

checkCache

boolean checkCache(Map<String,String> headers)
Check the cache for the current URL, and load it if it is valid.

Parameters:
headers - for the request
Returns:
true if cached response is used.

handleSslErrorRequest

public void handleSslErrorRequest(SslError error)
SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly

Specified by:
handleSslErrorRequest in interface EventHandler

realm

String realm()
Returns:
HTTP authentication realm or null if none.

authCredentialsInvalid

boolean authCredentialsInvalid()
Returns true iff an HTTP authentication problem has occured (credentials invalid).


sslError

SslError sslError()
Returns:
The last SSL error or null if there is none

handleSslErrorResponse

void handleSslErrorResponse(boolean proceed)
Handles SSL error(s) on the way down from the user (the user has already provided their feedback).


handleAuthResponse

void handleAuthResponse(String username,
                        String password)
Uses user-supplied credentials to restar a request.


setCacheLoader

void setCacheLoader(CacheLoader result)
Set the CacheLoader for the case where we might want to load from cache

Parameters:
result -

setRequestData

void setRequestData(String method,
                    Map<String,String> headers,
                    String postData,
                    boolean isHighPriority)
This is called when a request can be satisfied by the cache, however, the cache result could be a redirect. In this case we need to issue the network request.

Parameters:
method -
headers -
postData -
isHighPriority -

url

String url()
Returns:
The current URL associated with this load.

getWebAddress

WebAddress getWebAddress()
Returns:
The current WebAddress associated with this load.

host

String host()
Returns:
URL hostname (current URL).

originalUrl

String originalUrl()
Returns:
The original URL associated with this load.

attachRequestHandle

void attachRequestHandle(RequestHandle requestHandle)

detachRequestHandle

void detachRequestHandle()

downloadFile

void downloadFile()

willLoadFromCache

static boolean willLoadFromCache(String url)

resetCancel

void resetCancel()

mimeType

String mimeType()

contentLength

long contentLength()

tearDown

void tearDown()
Tear down the load. Subclasses should clean up any mess because of cancellation or errors during the load.


notifyError

void notifyError()
Notify the loader we encountered an error.


cancel

public void cancel()
Cancel a request. FIXME: This will only work if the request has yet to be handled. This is in no way guarenteed if requests are served in a separate thread. It also causes major problems if cancel is called during an EventHandler's method call.


setUrl

void setUrl(String url)
Sets the current URL associated with this load.


loadSynchronousMessages

void loadSynchronousMessages()
Cycle through our messages for synchronous loads.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature