public abstract class SonicSessionClient
extends java.lang.Object
SonicSessionClient
is a thin API class that delegates its public API to
a backend WebView class instance, such as loadUrl and loadDataWithBaseUrl.构造器和说明 |
---|
SonicSessionClient() |
限定符和类型 | 方法和说明 |
---|---|
void |
bindSession(SonicSession session)
Bind a sonic session to current client
|
void |
clearHistory()
We add this method to decoupling webview since some application may use x5 webview or others.
|
void |
clientReady()
Notify client is ready to accept data
|
void |
getDiffData(SonicDiffDataCallback callback)
The page execute a java script function to invoke a native method by javascript interface,
this callback will be called when sonic has finished diff data.
|
abstract void |
loadDataWithBaseUrl(java.lang.String baseUrl,
java.lang.String data,
java.lang.String mimeType,
java.lang.String encoding,
java.lang.String historyUrl)
We add this method to decoupling webview since some application may use x5 webview or others.
|
abstract void |
loadDataWithBaseUrlAndHeader(java.lang.String baseUrl,
java.lang.String data,
java.lang.String mimeType,
java.lang.String encoding,
java.lang.String historyUrl,
java.util.HashMap<java.lang.String,java.lang.String> headers)
We add this method to decoupling webview since some application may use x5 webview or others.
|
abstract void |
loadUrl(java.lang.String url,
android.os.Bundle extraData)
We add this method to decoupling webview since some application may use x5 webview or others.
|
void |
pageFinish(java.lang.String url)
We need to tell the session when onPageFinished is called by WebViewClient since to make a
better reload when current hit template-changed case.
|
java.lang.Object |
requestResource(java.lang.String url)
Webview ask the host client to intercept request, this method should be called when webview
call shouldInterceptRequest.
|
public void clientReady()
public java.lang.Object requestResource(java.lang.String url)
url
- The target url which need to request web responsepublic void getDiffData(SonicDiffDataCallback callback)
callback
- A callback of web pagepublic void pageFinish(java.lang.String url)
url
- The target url which is page finishedpublic void bindSession(SonicSession session)
session
- A sonic sessionpublic abstract void loadUrl(java.lang.String url, android.os.Bundle extraData)
url
- Url which need to loadextraData
- Extra datapublic abstract void loadDataWithBaseUrl(java.lang.String baseUrl, java.lang.String data, java.lang.String mimeType, java.lang.String encoding, java.lang.String historyUrl)
baseUrl
- The URL to use as the page's base URL. If null defaults to
'about:blank'.data
- A String of data in the given encodingmimeType
- the MIMEType of the data, e.g. 'text/html'. If null,
defaults to 'text/html'.encoding
- The encoding of the datahistoryUrl
- The URL to use as the history entry. If null defaults
to 'about:blank'. If non-null, this must be a valid URL.public abstract void loadDataWithBaseUrlAndHeader(java.lang.String baseUrl, java.lang.String data, java.lang.String mimeType, java.lang.String encoding, java.lang.String historyUrl, java.util.HashMap<java.lang.String,java.lang.String> headers)
baseUrl
- The URL to use as the page's base URL. If null defaults to
'about:blank'.data
- A String of data in the given encodingmimeType
- The MIMEType of the data, e.g. 'text/html'. If null,
defaults to 'text/html'.encoding
- The encoding of the datahistoryUrl
- The URL to use as the history entry. If null defaults
to 'about:blank'. If non-null, this must be a valid URL.headers
- The headerspublic void clearHistory()