public class QuickSonicSession extends SonicSession implements android.os.Handler.Callback
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.CallbackCHROME_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, getCustomHeadFieldEtagKey, 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, switchStatepublic boolean handleMessage(android.os.Message msg)
SonicSessionhandleMessage 在接口中 android.os.Handler.CallbackhandleMessage 在类中 SonicSessionprotected void handleFlow_LoadLocalCache(java.lang.String cacheHtml)
handleFlow_LoadLocalCache 在类中 SonicSessioncacheHtml - local cache of htmlpublic boolean onWebReady(SonicDiffDataCallback callback)
SonicSessiononWebReady 在类中 SonicSessioncallback - Sonic provides the latest data to the page through this callbackpublic boolean onClientReady()
SonicSessiononClientReady 在类中 SonicSessionprotected java.lang.Object onRequestResource(java.lang.String url)
SonicSessiononRequestResource 在类中 SonicSessionurl - The url of this sessionprotected void handleFlow_HttpError(int responseCode)
handleFlow_HttpError 在类中 SonicSessionprotected void handleFlow_ServiceUnavailable()
protected void handleFlow_TemplateChange(java.lang.String newHtml)
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 在类中 SonicSessionnewHtml - html content from serverprotected void handleFlow_FirstLoad()
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 在类中 SonicSessionprotected void handleFlow_DataUpdate(java.lang.String serverRsp)
CLIENT_CORE_MSG_DATA_UPDATE message.handleFlow_DataUpdate 在类中 SonicSessionserverRsp - Server response dataprotected void clearSessionData()
clearSessionData 在类中 SonicSession