sonic-android/docs/javadoc/com/tencent/sonic/sdk/QuickSonicSession.html
com.tencent.sonic.sdk
java.lang.Object
所有已实现的接口:android.os.Handler.Callback
public classQuickSonicSessionextends[SonicSession](../../../../com/tencent/sonic/sdk/SonicSession.html "com.tencent.sonic.sdk中的类")implements android.os.Handler.Callback
A subclass of SonicSession. QuickSonicSession mainly uses SonicSessionClient.loadDataWithBaseUrlAndHeader(String, String, String, String, String, HashMap) to load data. Sometime, it will use SonicSessionClient.loadUrl(String, Bundle) instead. By using SonicSessionClient.loadDataWithBaseUrlAndHeader(String, String, String, String, String, HashMap), WebView will quickly load web pages without the network affecting.
ATTENTION: Standard WebView don't have head information (such as csp) when it calls SonicSessionClient.loadDataWithBaseUrlAndHeader(String, String, String, String, String, HashMap) method. So this session mode may cause a security risk. However, you can put the csp contents into the html to avoid this risk caused by the lack of csp.
See also StandardSonicSession
-
SonicSession.Callback
-
CHROME_FILE_THREAD, CLIENT_MSG_NOTIFY_RESULT, CLIENT_MSG_ON_WEB_READY, clientIsReady, clientIsReload, COMMON_MSG_BEGIN, COMMON_MSG_END, config, createdTime, DATA_UPDATE_BUNDLE_PARAMS_DIFF, diffDataCallback, FILE_THREAD_MSG_BEGIN, FILE_THREAD_SAVE_CACHE_ON_SERVER_CLOSE, FILE_THREAD_SAVE_CACHE_ON_SESSION_FINISHED, fileHandler, finalResultCode, id, intent, isPreload, isWaitingForDestroy, isWaitingForSaveFile, isWaitingForSessionThread, mainHandler, OFFLINE_MODE_FALSE, OFFLINE_MODE_HTTP, OFFLINE_MODE_STORE, OFFLINE_MODE_TRUE, pendingDiffData, pendingWebResourceStream, preloadLinks, RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD, RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD, RESOURCE_INTERCEPT_STATE_NONE, resourceDownloaderEngine, resourceInterceptState, server, SESSION_MSG_FORCE_DESTROY, sessionCallbackList, sessionClient, sessionState, sId, sNextSessionLogId, SONIC_RESULT_CODE_DATA_UPDATE, SONIC_RESULT_CODE_FIRST_LOAD, SONIC_RESULT_CODE_HIT_CACHE, SONIC_RESULT_CODE_TEMPLATE_CHANGE, SONIC_RESULT_CODE_UNKNOWN, srcResultCode, srcUrl, STATE_DESTROY, STATE_NONE, STATE_READY, STATE_RUNNING, stateChangedCallbackList, statistics, wasInterceptInvoked, wasOnPageFinishInvoked, WEB_RESPONSE_CODE, WEB_RESPONSE_DATA, WEB_RESPONSE_EXTRA, WEB_RESPONSE_LOCAL_REFRESH_TIME, WEB_RESPONSE_SRC_CODE
所有方法 实例方法 具体方法 | 限定符和类型 | 方法和说明 |
| --- | --- |
| protected void | clearSessionData() |
| protected void | handleFlow_DataUpdate(java.lang.String serverRsp)
In this case sonic obtains the difference data between the server and the local data first,then sonic will build the template and server data into html, then send a CLIENT_CORE_MSG_DATA_UPDATE message.
|
| protected void | handleFlow_FirstLoad()
In this case sonic will always read the new data from the server until the client initiates a resource interception.
|
| protected void | handleFlow_HttpError(int responseCode) |
| protected void | handleFlow_LoadLocalCache(java.lang.String cacheHtml)
Handle load local cache of html if exist.
|
| protected void | handleFlow_ServiceUnavailable() |
| protected void | handleFlow_TemplateChange(java.lang.String newHtml)
In this case sonic will always read the new data from the server until the local page finish.
|
| boolean | handleMessage(android.os.Message msg)
Subclasses must implement this to receive messages.
|
| boolean | onClientReady()
Client informs sonic that it is ready.
|
| protected java.lang.Object | onRequestResource(java.lang.String url)
When the webview initiates a main resource interception, the client invokes this method to retrieve the data
|
| boolean | onWebReady(SonicDiffDataCallback callback)
Client will call this method to obtain the update data when the page shows the content.
|
-
addSessionCallback, addSessionStateChangedCallback, bindClient, canDestroy, createConnectionIntent, destroy, destroy, doSaveSonicCache, getCacheHeaders, getCharsetFromHeaders, getCharsetFromHeaders, getCurrentUrl, getFinalResultCode, getHeaders, getSessionClient, getSrcResultCode, getStatistics, handleFlow_Connection, handleFlow_NotModified, isDestroyedOrWaitingForDestroy, isMatchCurrentUrl, isPreload, notifyStateChange, onClientPageFinished, onClientRequestResource, onServerClosed, postForceDestroyIfNeed, postTaskToSaveSonicCache, refresh, removeSessionCallback, removeSessionStateChangedCallback, setCookiesFromHeaders, setResult, shouldSetCookieAsynchronous, start, switchState
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public boolean handleMessage(android.os.Message msg)
从类复制的说明: SonicSession
Subclasses must implement this to receive messages.
指定者:handleMessage 在接口中 android.os.Handler.Callback覆盖:handleMessage 在类中 SonicSession
-
protected void handleFlow_LoadLocalCache(java.lang.String cacheHtml)
Handle load local cache of html if exist. This handle is called before connection.
指定者:handleFlow_LoadLocalCache 在类中 SonicSession参数:cacheHtml - local cache of html
-
public boolean onWebReady([SonicDiffDataCallback](../../../../com/tencent/sonic/sdk/SonicDiffDataCallback.html "com.tencent.sonic.sdk中的接口")callback)
从类复制的说明: SonicSession
Client will call this method to obtain the update data when the page shows the content.
覆盖:onWebReady 在类中 SonicSession参数:callback - Sonic provides the latest data to the page through this callback返回:The result
-
public boolean onClientReady()
从类复制的说明: SonicSession
Client informs sonic that it is ready. Client ready means it's webview has been initialized, can start load url or load data.
覆盖:onClientReady 在类中 SonicSession返回:True if it is set for the first time
-
protected java.lang.Object onRequestResource(java.lang.String url)
从类复制的说明: SonicSession
When the webview initiates a main resource interception, the client invokes this method to retrieve the data
覆盖:onRequestResource 在类中 SonicSession参数:url - The url of this session返回:Return the data to kernel
-
protected void handleFlow_HttpError(int responseCode)
指定者:handleFlow_HttpError 在类中 SonicSession
-
protected void handleFlow_ServiceUnavailable()
指定者:handleFlow_ServiceUnavailable 在类中 SonicSession
-
protected void handleFlow_TemplateChange(java.lang.String newHtml)
In this case sonic will always read the new data from the server until the local page finish. If the server data is read finished, sonic will send a CLIENT_CORE_MSG_TEMPLATE_CHANGE message. If the server data is not read finished sonic will split the read and unread data into a bridgedStreamSonicSessionStream. When the client initiates a resource interception, sonic will provide the bridgedStream to the kernel.
If need save and separate data, sonic will save the server data and separate the server data to template and data.
指定者:handleFlow_TemplateChange 在类中 SonicSession参数:newHtml - html content from server
-
protected void handleFlow_FirstLoad()
In this case sonic will always read the new data from the server until the client initiates a resource interception. If the server data is read finished, sonic will send CLIENT_CORE_MSG_FIRST_LOAD message with the new html content from server. If the server data is not read finished sonic will split the read and unread data into a bridgedStreamSonicSessionStream.When client initiates a resource interception, sonic will provide the bridgedStream to the kernel.
If need save and separate data, sonic will save the server data and separate the server data to template and data.
指定者:handleFlow_FirstLoad 在类中 SonicSession
-
protected void handleFlow_DataUpdate(java.lang.String serverRsp)
In this case sonic obtains the difference data between the server and the local data first,then sonic will build the template and server data into html, then send a CLIENT_CORE_MSG_DATA_UPDATE message.
指定者:handleFlow_DataUpdate 在类中 SonicSession参数:serverRsp - Server response data
-
protected void clearSessionData()
覆盖:clearSessionData 在类中 SonicSession