sonic-android/docs/javadoc/com/tencent/sonic/sdk/SonicSessionClient.html
com.tencent.sonic.sdk
java.lang.Object
public abstract classSonicSessionClientextends 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.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public SonicSessionClient()
-
public void clientReady()
Notify client is ready to accept data
-
public 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.
参数:url - The target url which need to request web response返回:The data to kernel.
-
public void getDiffData([SonicDiffDataCallback](../../../../com/tencent/sonic/sdk/SonicDiffDataCallback.html "com.tencent.sonic.sdk中的接口")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.
参数:callback - A callback of web page
-
public 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.
参数:url - The target url which is page finished
-
public void bindSession([SonicSession](../../../../com/tencent/sonic/sdk/SonicSession.html "com.tencent.sonic.sdk中的类")session)
Bind a sonic session to current client
参数:session - A sonic session
-
public 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.
参数:url - Url which need to loadextraData - Extra data
-
public 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.
参数: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)
We add this method to decoupling webview since some application may use x5 webview or others.
参数: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 headers
-
public void clearHistory()
We add this method to decoupling webview since some application may use x5 webview or others. When we hit template-change case, webview may load twice(first load:local cache second load:new page) when user press back button, if we do not clear history,it will return to the first load case which will make user feel unsure about the action. So we need to clear history if need.