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.Callback
callbackWeakRefList, CLIENT_MSG_NOTIFY_RESULT, CLIENT_MSG_ON_WEB_READY, clientIsReady, COMMON_MSG_BEGIN, COMMON_MSG_END, config, createdTime, currUrl, DATA_UPDATE_BUNDLE_PARAMS_DIFF, diffDataCallback, finalResultCode, id, isPreload, isWaitingForDestroy, isWaitingForSaveFile, isWaitingForSessionThread, mainHandler, OFFLINE_MODE_FALSE, OFFLINE_MODE_HTTP, OFFLINE_MODE_STORE, OFFLINE_MODE_TRUE, pendingDiffData, pendingWebResourceStream, SESSION_MSG_FORCE_DESTROY, sessionClient, sessionConnection, 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, SONIC_URL_PARAM_SESSION_ID, srcResultCode, srcUrl, STATE_DESTROY, STATE_NONE, STATE_READY, STATE_RUNNING, statistics, wasInterceptInvoked, wasOnPageFinishInvoked, WEB_RESPONSE_CODE, WEB_RESPONSE_DATA, WEB_RESPONSE_LOCAL_REFRESH_TIME, WEB_RESPONSE_SRC_CODE
限定符和类型 | 方法和说明 |
---|---|
protected void |
clearSessionData() |
protected void |
handleFlow_304()
Handle 304
SonicSession.SONIC_RESULT_CODE_HIT_CACHE , it just updates the sonic code. |
protected void |
handleFlow_DataUpdate()
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_ServiceUnavailable() |
protected void |
handleFlow_TemplateChange()
In this case sonic will always read the new data from the server until the local page finish.
|
protected void |
handleLocalHtml(java.lang.String localHtml) |
boolean |
handleMessage(android.os.Message msg)
Subclasses must implement this to receive messages.
|
boolean |
onClientReady()
Client informs sonic that it is ready.
|
java.lang.Object |
onClientRequestResource(java.lang.String url)
When the webview initiates a resource interception, the client invokes the 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.
|
addCallback, bindClient, canDestroy, destroy, destroy, getCurrentUrl, getFinalResultCode, getHeaders, getSessionClient, getSrcResultCode, getStatistics, handleFlow_Connection, isDestroyedOrWaitingForDestroy, isMatchCurrentUrl, isPreload, notifyStateChange, onClientPageFinished, onClose, postForceDestroyIfNeed, removeCallback, saveHeaders, separateAndSaveCache, setResult, start, switchState
public boolean handleMessage(android.os.Message msg)
SonicSession
handleMessage
在接口中 android.os.Handler.Callback
handleMessage
在类中 SonicSession
protected void handleLocalHtml(java.lang.String localHtml)
handleLocalHtml
在类中 SonicSession
public boolean onWebReady(SonicDiffDataCallback callback)
SonicSession
onWebReady
在类中 SonicSession
callback
- Sonic provides the latest data to the page through this callbackpublic boolean onClientReady()
SonicSession
onClientReady
在类中 SonicSession
public java.lang.Object onClientRequestResource(java.lang.String url)
SonicSession
onClientRequestResource
在类中 SonicSession
url
- The url of this sessionprotected void handleFlow_304()
SonicSession.SONIC_RESULT_CODE_HIT_CACHE
, it just updates the sonic code.handleFlow_304
在类中 SonicSession
protected void handleFlow_HttpError(int responseCode)
handleFlow_HttpError
在类中 SonicSession
protected void handleFlow_ServiceUnavailable()
protected void handleFlow_TemplateChange()
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.
protected 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
在类中 SonicSession
protected void handleFlow_DataUpdate()
CLIENT_CORE_MSG_DATA_UPDATE
message.handleFlow_DataUpdate
在类中 SonicSession
protected void clearSessionData()
clearSessionData
在类中 SonicSession