public class StandardSonicSession extends SonicSession implements android.os.Handler.Callback
SonicSessionClient.loadUrl(String, Bundle)
(not loadData). When client initiates a resource interception, the user can set response and header
information (such as csp) for the kernel.
See also QuickSonicSession
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
限定符和类型 | 方法和说明 |
---|---|
int |
getSrcResultCode() |
protected void |
handleFlow_DataUpdate(java.lang.String serverRsp)
Sonic obtains the difference data between the server and the local data first,then sonic will
build the template and server data into html.If client did not load url before, the new html
will be encapsulated as an inputStream
ByteArrayInputStream ,When client initiates
a resource interception, sonic provides the inputStream to the kernel. |
protected void |
handleFlow_FirstLoad()
Sonic will always read the new data from the server until client initiates a resource interception
If the server data is not read finished sonic will split the read and unread data into a
bridgedStream
SonicSessionStream , otherwise all the read data will be encapsulated as an
inputStreamByteArrayInputStream . |
protected void |
handleFlow_HttpError(int responseCode) |
protected void |
handleFlow_LoadLocalCache(java.lang.String localHtml) |
protected void |
handleFlow_ServiceUnavailable() |
protected void |
handleFlow_TemplateChange(java.lang.String newHtml)
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, clearSessionData, createConnectionIntent, destroy, destroy, doSaveSonicCache, getCacheHeaders, getCharsetFromHeaders, getCharsetFromHeaders, getCurrentUrl, getFinalResultCode, getHeaders, getSessionClient, getStatistics, handleFlow_Connection, handleFlow_NotModified, isDestroyedOrWaitingForDestroy, isMatchCurrentUrl, isPreload, notifyStateChange, onClientPageFinished, onClientRequestResource, onServerClosed, postForceDestroyIfNeed, postTaskToSaveSonicCache, refresh, removeSessionCallback, removeSessionStateChangedCallback, setCookiesFromHeaders, setResult, shouldSetCookieAsynchronous, start, switchState
public int getSrcResultCode()
getSrcResultCode
在类中 SonicSession
public boolean handleMessage(android.os.Message msg)
SonicSession
handleMessage
在接口中 android.os.Handler.Callback
handleMessage
在类中 SonicSession
public boolean onClientReady()
SonicSession
onClientReady
在类中 SonicSession
public boolean onWebReady(SonicDiffDataCallback callback)
SonicSession
onWebReady
在类中 SonicSession
callback
- Sonic provides the latest data to the page through this callbackprotected java.lang.Object onRequestResource(java.lang.String url)
SonicSession
onRequestResource
在类中 SonicSession
url
- The url of this sessionprotected void handleFlow_LoadLocalCache(java.lang.String localHtml)
handleFlow_LoadLocalCache
在类中 SonicSession
protected void handleFlow_TemplateChange(java.lang.String newHtml)
SonicSessionStream
, otherwise all the read data will be
encapsulated as an inputStreamByteArrayInputStream
. When client
initiates a resource interception, sonic will provide the bridgedStream or inputStream 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
- new Html string from web-serverprotected void handleFlow_HttpError(int responseCode)
handleFlow_HttpError
在类中 SonicSession
protected void handleFlow_ServiceUnavailable()
protected void handleFlow_FirstLoad()
SonicSessionStream
, otherwise all the read data will be encapsulated as an
inputStreamByteArrayInputStream
. When client initiates a resource interception,
sonic will provide the bridgedStream or inputStream 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)
ByteArrayInputStream
,When client initiates
a resource interception, sonic provides the inputStream to the kernel.
If client did load url before, sonic provides the diff data to page when page obtains the diff data.handleFlow_DataUpdate
在类中 SonicSession
serverRsp
- Server response data.