Back to Vassonic

SonicSessionClient (sdk 3.0.0 API)

sonic-android/docs/javadoc/com/tencent/sonic/sdk/SonicSessionClient.html

3.1.18.4 KB
Original Source

跳过导航链接

com.tencent.sonic.sdk

类 SonicSessionClient

  • java.lang.Object

    • com.tencent.sonic.sdk.SonicSessionClient

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. |

- 

从类继承的方法 java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

构造器详细资料

- 

SonicSessionClient

public SonicSessionClient()

方法详细资料

- 

clientReady

public void clientReady()

Notify client is ready to accept data

- 

requestResource

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.

- 

getDiffData

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

- 

pageFinish

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

- 

bindSession

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

- 

loadUrl

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

- 

loadDataWithBaseUrl

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.

- 

loadDataWithBaseUrlAndHeader

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

- 

clearHistory

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.

跳过导航链接