public class

XWalkResourceClient

extends XWalkResourceClientInternal
java.lang.Object
   ↳ XWalkResourceClientInternal
     ↳ org.xwalk.core.XWalkResourceClient

Class Overview

This class notifies the embedder resource events/callbacks.

Summary

Constants
int ERROR_AUTHENTICATION User authentication failed on server
int ERROR_BAD_URL Malformed URL
int ERROR_CONNECT Failed to connect to the server
int ERROR_FAILED_SSL_HANDSHAKE Failed to perform SSL handshake
int ERROR_FILE Generic file error
int ERROR_FILE_NOT_FOUND File not found
int ERROR_HOST_LOOKUP Server or proxy hostname lookup failed
int ERROR_IO Failed to read or write to the server
int ERROR_OK Success
int ERROR_PROXY_AUTHENTICATION User authentication failed on proxy
int ERROR_REDIRECT_LOOP Too many redirects
int ERROR_TIMEOUT Connection timed out
int ERROR_TOO_MANY_REQUESTS Too many requests during this load
int ERROR_UNKNOWN Generic error
int ERROR_UNSUPPORTED_AUTH_SCHEME Unsupported authentication scheme (not basic or digest)
int ERROR_UNSUPPORTED_SCHEME Unsupported URI scheme
Public Constructors
XWalkResourceClient(XWalkView view)
Constructor.
Public Methods
void onLoadFinished(XWalkView view, String url)
Notify the client that the XWalkView completes to load the resource specified by the given url.
void onLoadStarted(XWalkView view, String url)
Notify the client that the XWalkView will load the resource specified by the given url.
void onProgressChanged(XWalkView view, int progressInPercent)
Notify the client the progress info of loading a specific url.
void onReceivedLoadError(XWalkView view, int errorCode, String description, String failingUrl)
Report an error to the client.
WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url)
Notify the client of a resource request and allow the client to return the data.
boolean shouldOverrideUrlLoading(XWalkView view, String url)
Give the host application a chance to take over the control when a new url is about to be loaded in the current XWalkView.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ERROR_AUTHENTICATION

User authentication failed on server

Constant Value: -4 (0xfffffffc)

public static final int ERROR_BAD_URL

Malformed URL

Constant Value: -12 (0xfffffff4)

public static final int ERROR_CONNECT

Failed to connect to the server

Constant Value: -6 (0xfffffffa)

public static final int ERROR_FAILED_SSL_HANDSHAKE

Failed to perform SSL handshake

Constant Value: -11 (0xfffffff5)

public static final int ERROR_FILE

Generic file error

Constant Value: -13 (0xfffffff3)

public static final int ERROR_FILE_NOT_FOUND

File not found

Constant Value: -14 (0xfffffff2)

public static final int ERROR_HOST_LOOKUP

Server or proxy hostname lookup failed

Constant Value: -2 (0xfffffffe)

public static final int ERROR_IO

Failed to read or write to the server

Constant Value: -7 (0xfffffff9)

public static final int ERROR_OK

Success

Constant Value: 0 (0x00000000)

public static final int ERROR_PROXY_AUTHENTICATION

User authentication failed on proxy

Constant Value: -5 (0xfffffffb)

public static final int ERROR_REDIRECT_LOOP

Too many redirects

Constant Value: -9 (0xfffffff7)

public static final int ERROR_TIMEOUT

Connection timed out

Constant Value: -8 (0xfffffff8)

public static final int ERROR_TOO_MANY_REQUESTS

Too many requests during this load

Constant Value: -15 (0xfffffff1)

public static final int ERROR_UNKNOWN

Generic error

Constant Value: -1 (0xffffffff)

public static final int ERROR_UNSUPPORTED_AUTH_SCHEME

Unsupported authentication scheme (not basic or digest)

Constant Value: -3 (0xfffffffd)

public static final int ERROR_UNSUPPORTED_SCHEME

Unsupported URI scheme

Constant Value: -10 (0xfffffff6)

Public Constructors

public XWalkResourceClient (XWalkView view)

Constructor.

Parameters
view the owner XWalkView instance.

Public Methods

public void onLoadFinished (XWalkView view, String url)

Notify the client that the XWalkView completes to load the resource specified by the given url.

Parameters
view the owner XWalkView instance.
url the url for the resource done for loading.

public void onLoadStarted (XWalkView view, String url)

Notify the client that the XWalkView will load the resource specified by the given url.

Parameters
view the owner XWalkView instance.
url the url for the resource to be loaded.

public void onProgressChanged (XWalkView view, int progressInPercent)

Notify the client the progress info of loading a specific url.

Parameters
view the owner XWalkView instance.
progressInPercent the loading process in percent.

public void onReceivedLoadError (XWalkView view, int errorCode, String description, String failingUrl)

Report an error to the client.

Parameters
view the owner XWalkView instance.
errorCode the error id.
description A String describing the error.
failingUrl The url that failed to load.

public WebResourceResponse shouldInterceptLoadRequest (XWalkView view, String url)

Notify the client of a resource request and allow the client to return the data. If the return value is null, the XWalkView will continue to load the resource as usual. Otherwise, the return response and data will be used. NOTE: This method is called by the network thread so clients should exercise caution when accessing private data.

Parameters
view The XWalkView that is requesting the resource.
url The raw url of the resource.
Returns
  • A android.webkit.WebResourceResponse containing the response information or null if the XWalkView should load the resource itself.

public boolean shouldOverrideUrlLoading (XWalkView view, String url)

Give the host application a chance to take over the control when a new url is about to be loaded in the current XWalkView. If XWalkClient is not provided, by default XWalkView will ask Activity Manager to choose the proper handler for the url. If XWalkClient is provided, return true means the host application handles the url, while return false means the current XWalkView handles the url.

Parameters
view The XWalkView that is initiating the callback.
url The url to be loaded.
Returns
  • True if the host application wants to leave the current XWalkView and handle the url itself, otherwise return false.