Back to Vassonic

SonicSession (sdk 3.0.0 API)

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

3.1.137.4 KB
Original Source

跳过导航链接

com.tencent.sonic.sdk

类 SonicSession


public abstract classSonicSessionextends java.lang.Object
implements android.os.Handler.Callback

In Sonic, SonicSessions are used to manage the entire process,include obtain the latest data from the server, provide local and latest data to kernel, separate html to template and data, build template and data to html and so on. Each url involves one session at a time, that session will be destroyed when the page is destroyed.

嵌套类概要

嵌套类 | 限定符和类型 | 类和说明 | | --- | --- | | static interface | SonicSession.Callback The interface is used to inform the listeners that the state of the session has changed. |

字段概要

字段 | 限定符和类型 | 字段和说明 | | --- | --- | | static java.lang.String | CHROME_FILE_THREAD Name of chrome file thread | | protected static int | CLIENT_MSG_NOTIFY_RESULT The message to record sonic mode. | | protected static int | CLIENT_MSG_ON_WEB_READY The message of page ready, its means page want to get the latest session data. | | protected java.util.concurrent.atomic.AtomicBoolean | clientIsReady Whether the client is ready. | | protected java.util.concurrent.atomic.AtomicBoolean | clientIsReload Indicate current session is reload or not. | | protected static int | COMMON_MSG_BEGIN | | protected static int | COMMON_MSG_END | | SonicSessionConfig | config | | long | createdTime The time of current session created. | | static java.lang.String | DATA_UPDATE_BUNDLE_PARAMS_DIFF | | protected SonicDiffDataCallback | diffDataCallback | | protected static int | FILE_THREAD_MSG_BEGIN | | protected static int | FILE_THREAD_SAVE_CACHE_ON_SERVER_CLOSE The message of saving sonic cache while server close. | | protected static int | FILE_THREAD_SAVE_CACHE_ON_SESSION_FINISHED The message of saving sonic cache while session finish. | | protected android.os.Handler | fileHandler | | protected int | finalResultCode Sonic final mode. | | java.lang.String | id | | protected android.content.Intent | intent This intent saves all of the initialization param. | | protected boolean | isPreload Whether current session is preload. | | protected java.util.concurrent.atomic.AtomicBoolean | isWaitingForDestroy Whether the session is waiting for destroy. | | protected java.util.concurrent.atomic.AtomicBoolean | isWaitingForSaveFile Whether it is waiting for the file to be saved. | | protected java.util.concurrent.atomic.AtomicBoolean | isWaitingForSessionThread Whether the session is waiting for data. | | protected android.os.Handler | mainHandler | | static java.lang.String | OFFLINE_MODE_FALSE The value of "cache-offline" in http(s) response headers. | | static java.lang.String | OFFLINE_MODE_HTTP The value of "cache-offline" in http(s) response headers. | | static java.lang.String | OFFLINE_MODE_STORE The value of "cache-offline" in http(s) response headers. | | static java.lang.String | OFFLINE_MODE_TRUE The value of "cache-offline" in http(s) response headers. | | protected java.lang.String | pendingDiffData The difference data between local and server data. | | protected java.io.InputStream | pendingWebResourceStream The response for client interception. | | protected java.util.List<java.lang.String> | preloadLinks | | protected static int | RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD Resource Intercept State : intercepting in file thread | | protected static int | RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD Resource Intercept State : intercepting in other thread(may be IOThread or other else) | | protected static int | RESOURCE_INTERCEPT_STATE_NONE Resource Intercept State : none | | protected SonicDownloadEngine | resourceDownloaderEngine Sonic sub resource downloader | | protected java.util.concurrent.atomic.AtomicInteger | resourceInterceptState Resource intercept state, include RESOURCE_INTERCEPT_STATE_NONE, RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD, RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD More about it at {https://codereview.chromium.org/1350553005/#ps20001} | | protected SonicServer | server Sonic server | | protected static int | SESSION_MSG_FORCE_DESTROY The message of forced to destroy the session. | | protected java.util.concurrent.CopyOnWriteArrayList<java.lang.ref.WeakReference<com.tencent.sonic.sdk.SonicSessionCallback>> | sessionCallbackList | | protected SonicSessionClient | sessionClient | | protected java.util.concurrent.atomic.AtomicInteger | sessionState Session state, include STATE_NONE, STATE_RUNNING, STATE_READY and STATE_DESTROY. | | long | sId The integer id of current session | | protected static long | sNextSessionLogId Log id | | static int | SONIC_RESULT_CODE_DATA_UPDATE Sonic mode : data update. | | static int | SONIC_RESULT_CODE_FIRST_LOAD Sonic mode : first load. | | static int | SONIC_RESULT_CODE_HIT_CACHE Sonic mode : 304. | | static int | SONIC_RESULT_CODE_TEMPLATE_CHANGE Sonic mode : template change. | | static int | SONIC_RESULT_CODE_UNKNOWN Sonic mode : unknown. | | protected int | srcResultCode Sonic original mode. | | java.lang.String | srcUrl The original url | | static int | STATE_DESTROY Session state : destroyed. | | static int | STATE_NONE Session state : original. | | static int | STATE_READY Session state : ready. | | static int | STATE_RUNNING Session state : running. | | protected java.util.concurrent.CopyOnWriteArrayList<java.lang.ref.WeakReference<SonicSession.Callback>> | stateChangedCallbackList | | protected SonicSessionStatistics | statistics Session statics var | | static java.lang.String | TAG Log filter | | protected java.util.concurrent.atomic.AtomicBoolean | wasInterceptInvoked Whether the client initiates a resource interception. | | protected java.util.concurrent.atomic.AtomicBoolean | wasOnPageFinishInvoked Whether the local html is loaded, it is used only the template changes. | | static java.lang.String | WEB_RESPONSE_CODE The result keyword to page : the value is finalResultCode | | static java.lang.String | WEB_RESPONSE_DATA The all data keyword to page | | static java.lang.String | WEB_RESPONSE_EXTRA | | static java.lang.String | WEB_RESPONSE_LOCAL_REFRESH_TIME | | static java.lang.String | WEB_RESPONSE_SRC_CODE The result keyword to page : the value is srcResultCode |

方法概要

所有方法 实例方法 抽象方法 具体方法 | 限定符和类型 | 方法和说明 | | --- | --- | | boolean | addSessionCallback(com.tencent.sonic.sdk.SonicSessionCallback callback) | | protected boolean | addSessionStateChangedCallback(SonicSession.Callback callback) | | boolean | bindClient(SonicSessionClient client) | | protected boolean | canDestroy() | | protected void | clearSessionData() | | protected android.content.Intent | createConnectionIntent(com.tencent.sonic.sdk.SonicDataHelper.SessionData sessionData) | | void | destroy() | | protected void | destroy(boolean force) | | protected void | doSaveSonicCache(SonicServer sonicServer, java.lang.String htmlString) | | protected java.util.HashMap<java.lang.String,java.lang.String> | getCacheHeaders() Get header info from local cache headers | | protected java.lang.String | getCharsetFromHeaders() Get the charset from the latest response http header. | | java.lang.String | getCharsetFromHeaders(java.util.Map<java.lang.String,java.lang.String> headers) | | java.lang.String | getCurrentUrl() | | int | getFinalResultCode() | | protected java.util.HashMap<java.lang.String,java.lang.String> | getHeaders() Get header info with the original url of current session. | | SonicSessionClient | getSessionClient() | | int | getSrcResultCode() | | SonicSessionStatistics | getStatistics() | | protected void | handleFlow_Connection(boolean hasCache, com.tencent.sonic.sdk.SonicDataHelper.SessionData sessionData) Initiate a network request to obtain server data. | | protected abstract void | handleFlow_DataUpdate(java.lang.String serverRsp) Handle data update SONIC_RESULT_CODE_DATA_UPDATE logic. | | protected abstract void | handleFlow_FirstLoad() Handle sonic first SONIC_RESULT_CODE_FIRST_LOAD logic. | | protected abstract void | handleFlow_HttpError(int responseCode) | | protected abstract void | handleFlow_LoadLocalCache(java.lang.String cacheHtml) | | protected void | handleFlow_NotModified() | | protected abstract void | handleFlow_ServiceUnavailable() | | protected abstract void | handleFlow_TemplateChange(java.lang.String newHtml) Handle template update SONIC_RESULT_CODE_TEMPLATE_CHANGE logic. | | boolean | handleMessage(android.os.Message msg) Subclasses must implement this to receive messages. | | boolean | isDestroyedOrWaitingForDestroy() | | boolean | isMatchCurrentUrl(java.lang.String url) Whether the incoming url matches the current url,it will ignore url parameters | | boolean | isPreload() | | protected void | notifyStateChange(int oldState, int newState, android.os.Bundle extraData) When the session state changes, notify the listeners. | | boolean | onClientPageFinished(java.lang.String url) | | 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 | | 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 | | void | onServerClosed(SonicServer sonicServer, boolean readComplete) If the kernel obtain inputStream from a SonicSessionStream, the inputStream will be closed when the kernel reads the data.This method is invoked when the sonicSessionStream close. | | boolean | onWebReady(SonicDiffDataCallback diffDataCallback) Client will call this method to obtain the update data when the page shows the content. | | protected boolean | postForceDestroyIfNeed() Destroy the session if it is waiting for destroy and it is can be destroyed. | | protected void | postTaskToSaveSonicCache(java.lang.String htmlString) | | boolean | refresh() | | boolean | removeSessionCallback(com.tencent.sonic.sdk.SonicSessionCallback callback) | | protected boolean | removeSessionStateChangedCallback(SonicSession.Callback callback) | | protected boolean | setCookiesFromHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, boolean executeInNewThread) Set cookies to webview from headers | | protected void | setResult(int srcCode, int finalCode, boolean notify) Record the sonic mode, notify the result to page if necessary. | | protected boolean | shouldSetCookieAsynchronous() Whether should set cookie asynchronous or not , if onClientRequestResource is calling in IOThread, it should not call set cookie synchronous which will handle in IOThread as it may cause deadlock More about it see {https://issuetracker.google.com/issues/36989494#c8} Fix VasSonic issue {https://github.com/Tencent/VasSonic/issues/90} | | void | start() Start the sonic process | | protected boolean | switchState(int fromState, int toState, boolean notify) |

- 

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

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

字段详细资料

- 

TAG

public static final java.lang.String TAG

Log filter 另请参阅:常量字段值

- 

WEB_RESPONSE_SRC_CODE

public static final java.lang.String WEB_RESPONSE_SRC_CODE

The result keyword to page : the value is srcResultCode 另请参阅:常量字段值

- 

WEB_RESPONSE_CODE

public static final java.lang.String WEB_RESPONSE_CODE

The result keyword to page : the value is finalResultCode 另请参阅:常量字段值

- 

WEB_RESPONSE_EXTRA

public static final java.lang.String WEB_RESPONSE_EXTRA

另请参阅:常量字段值

- 

WEB_RESPONSE_DATA

public static final java.lang.String WEB_RESPONSE_DATA

The all data keyword to page 另请参阅:常量字段值

- 

DATA_UPDATE_BUNDLE_PARAMS_DIFF

public static final java.lang.String DATA_UPDATE_BUNDLE_PARAMS_DIFF

另请参阅:常量字段值

- 

WEB_RESPONSE_LOCAL_REFRESH_TIME

public static final java.lang.String WEB_RESPONSE_LOCAL_REFRESH_TIME

另请参阅:常量字段值

- 

CHROME_FILE_THREAD

public static final java.lang.String CHROME_FILE_THREAD

Name of chrome file thread 另请参阅:常量字段值

- 

STATE_NONE

public static final int STATE_NONE

Session state : original.

This state means session has not start.

另请参阅:常量字段值

- 

STATE_RUNNING

public static final int STATE_RUNNING

Session state : running.

This state means session has begun to request data from the server and is processing the data.

另请参阅:常量字段值

- 

STATE_READY

public static final int STATE_READY

Session state : ready.

This state means session data is available when the page initiates a resource interception. In other stats the client(kernel) will wait.

另请参阅:常量字段值

- 

STATE_DESTROY

public static final int STATE_DESTROY

Session state : destroyed.

This state means the session is destroyed.

另请参阅:常量字段值

- 

OFFLINE_MODE_HTTP

public static final java.lang.String OFFLINE_MODE_HTTP

The value of "cache-offline" in http(s) response headers.

This value means sonic server unavailable, the terminal does not take sonic logic for the next period of time,the value of time is defined in SonicConfig.SONIC_UNAVAILABLE_TIME

另请参阅:常量字段值

- 

OFFLINE_MODE_STORE

public static final java.lang.String OFFLINE_MODE_STORE

The value of "cache-offline" in http(s) response headers.

This value means sonic will save the latest data, but not refresh page.For example, when sonic mode is data update, sonic will not provide the difference data between local and server to page to refresh the content.

另请参阅:常量字段值

- 

OFFLINE_MODE_TRUE

public static final java.lang.String OFFLINE_MODE_TRUE

The value of "cache-offline" in http(s) response headers.

This value means sonic will save the latest data and refresh page content.

另请参阅:常量字段值

- 

OFFLINE_MODE_FALSE

public static final java.lang.String OFFLINE_MODE_FALSE

The value of "cache-offline" in http(s) response headers.

This value means sonic will refresh page content but not save date, sonic will remove the local data also.

另请参阅:常量字段值

- 

SONIC_RESULT_CODE_UNKNOWN

public static final int SONIC_RESULT_CODE_UNKNOWN

Sonic mode : unknown. 另请参阅:常量字段值

- 

SONIC_RESULT_CODE_FIRST_LOAD

public static final int SONIC_RESULT_CODE_FIRST_LOAD

Sonic mode : first load. 另请参阅:常量字段值

- 

SONIC_RESULT_CODE_TEMPLATE_CHANGE

public static final int SONIC_RESULT_CODE_TEMPLATE_CHANGE

Sonic mode : template change. 另请参阅:常量字段值

- 

SONIC_RESULT_CODE_DATA_UPDATE

public static final int SONIC_RESULT_CODE_DATA_UPDATE

Sonic mode : data update. 另请参阅:常量字段值

- 

SONIC_RESULT_CODE_HIT_CACHE

public static final int SONIC_RESULT_CODE_HIT_CACHE

Sonic mode : 304. 另请参阅:常量字段值

- 

srcResultCode

protected int srcResultCode

Sonic original mode.

For example, when local data does not exist, the value is SONIC_RESULT_CODE_FIRST_LOAD

- 

finalResultCode

protected int finalResultCode

Sonic final mode.

For example, when local data does not exist, the srcResultCode value is SONIC_RESULT_CODE_FIRST_LOAD. If the server data is read finished, sonic will provide the latest data to kernel when the kernel initiates a resource interception.This effect is the same as loading local data, so the sonic mode will be set as SONIC_RESULT_CODE_HIT_CACHE

- 

COMMON_MSG_BEGIN

protected static final int COMMON_MSG_BEGIN

另请参阅:常量字段值

- 

CLIENT_MSG_NOTIFY_RESULT

protected static final int CLIENT_MSG_NOTIFY_RESULT

The message to record sonic mode. 另请参阅:常量字段值

- 

CLIENT_MSG_ON_WEB_READY

protected static final int CLIENT_MSG_ON_WEB_READY

The message of page ready, its means page want to get the latest session data. 另请参阅:常量字段值

- 

SESSION_MSG_FORCE_DESTROY

protected static final int SESSION_MSG_FORCE_DESTROY

The message of forced to destroy the session. 另请参阅:常量字段值

- 

COMMON_MSG_END

protected static final int COMMON_MSG_END

另请参阅:常量字段值

- 

FILE_THREAD_MSG_BEGIN

protected static final int FILE_THREAD_MSG_BEGIN

另请参阅:常量字段值

- 

FILE_THREAD_SAVE_CACHE_ON_SERVER_CLOSE

protected static final int FILE_THREAD_SAVE_CACHE_ON_SERVER_CLOSE

The message of saving sonic cache while server close. 另请参阅:常量字段值

- 

FILE_THREAD_SAVE_CACHE_ON_SESSION_FINISHED

protected static final int FILE_THREAD_SAVE_CACHE_ON_SESSION_FINISHED

The message of saving sonic cache while session finish. 另请参阅:常量字段值

- 

RESOURCE_INTERCEPT_STATE_NONE

protected static final int RESOURCE_INTERCEPT_STATE_NONE

Resource Intercept State : none 另请参阅:常量字段值

- 

RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD

protected static final int RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD

Resource Intercept State : intercepting in file thread 另请参阅:常量字段值

- 

RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD

protected static final int RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD

Resource Intercept State : intercepting in other thread(may be IOThread or other else) 另请参阅:常量字段值

- 

sessionState

protected final java.util.concurrent.atomic.AtomicInteger sessionState

Session state, include STATE_NONE, STATE_RUNNING, STATE_READY and STATE_DESTROY.

- 

wasInterceptInvoked

protected final java.util.concurrent.atomic.AtomicBoolean wasInterceptInvoked

Whether the client initiates a resource interception.

- 

clientIsReady

protected final java.util.concurrent.atomic.AtomicBoolean clientIsReady

Whether the client is ready.

- 

isWaitingForSaveFile

protected final java.util.concurrent.atomic.AtomicBoolean isWaitingForSaveFile

Whether it is waiting for the file to be saved. If it is true, the session can not be destroyed.

- 

isWaitingForDestroy

protected final java.util.concurrent.atomic.AtomicBoolean isWaitingForDestroy

Whether the session is waiting for destroy.

- 

isWaitingForSessionThread

protected final java.util.concurrent.atomic.AtomicBoolean isWaitingForSessionThread

Whether the session is waiting for data. If it is true, the session can not be destroyed.

- 

wasOnPageFinishInvoked

protected final java.util.concurrent.atomic.AtomicBoolean wasOnPageFinishInvoked

Whether the local html is loaded, it is used only the template changes.

- 

resourceInterceptState

protected final java.util.concurrent.atomic.AtomicInteger resourceInterceptState

Resource intercept state, include RESOURCE_INTERCEPT_STATE_NONE, RESOURCE_INTERCEPT_STATE_IN_FILE_THREAD, RESOURCE_INTERCEPT_STATE_IN_OTHER_THREAD More about it at {https://codereview.chromium.org/1350553005/#ps20001}

- 

clientIsReload

protected final java.util.concurrent.atomic.AtomicBoolean clientIsReload

Indicate current session is reload or not.

- 

statistics

protected[SonicSessionStatistics](../../../../com/tencent/sonic/sdk/SonicSessionStatistics.html "com.tencent.sonic.sdk中的类")statistics

Session statics var

- 

server

protected volatile[SonicServer](../../../../com/tencent/sonic/sdk/SonicServer.html "com.tencent.sonic.sdk中的类")server

Sonic server

- 

resourceDownloaderEngine

protected volatile[SonicDownloadEngine](../../../../com/tencent/sonic/sdk/download/SonicDownloadEngine.html "com.tencent.sonic.sdk.download中的类")resourceDownloaderEngine

Sonic sub resource downloader

- 

pendingWebResourceStream

protected volatile java.io.InputStream pendingWebResourceStream

The response for client interception.

- 

pendingDiffData

protected java.lang.String pendingDiffData

The difference data between local and server data.

- 

sNextSessionLogId

protected static long sNextSessionLogId

Log id

- 

config

public final[SonicSessionConfig](../../../../com/tencent/sonic/sdk/SonicSessionConfig.html "com.tencent.sonic.sdk中的类")config
- 

id

public final java.lang.String id
- 

isPreload

protected boolean isPreload

Whether current session is preload.

- 

createdTime

public long createdTime

The time of current session created.

- 

sId

public final long sId

The integer id of current session

- 

srcUrl

public java.lang.String srcUrl

The original url

- 

sessionClient

protected volatile[SonicSessionClient](../../../../com/tencent/sonic/sdk/SonicSessionClient.html "com.tencent.sonic.sdk中的类")sessionClient
- 

mainHandler

protected final android.os.Handler mainHandler
- 

stateChangedCallbackList

protected final java.util.concurrent.CopyOnWriteArrayList<java.lang.ref.WeakReference<[SonicSession.Callback](../../../../com/tencent/sonic/sdk/SonicSession.Callback.html "com.tencent.sonic.sdk中的接口")>> stateChangedCallbackList
- 

diffDataCallback

protected[SonicDiffDataCallback](../../../../com/tencent/sonic/sdk/SonicDiffDataCallback.html "com.tencent.sonic.sdk中的接口")diffDataCallback
- 

fileHandler

protected final android.os.Handler fileHandler
- 

preloadLinks

protected java.util.List<java.lang.String> preloadLinks
- 

sessionCallbackList

protected final java.util.concurrent.CopyOnWriteArrayList<java.lang.ref.WeakReference<com.tencent.sonic.sdk.SonicSessionCallback>> sessionCallbackList
- 

intent

protected final android.content.Intent intent

This intent saves all of the initialization param.

方法详细资料

- 

handleMessage

public boolean handleMessage(android.os.Message msg)

Subclasses must implement this to receive messages. 指定者:handleMessage 在接口中 android.os.Handler.Callback

- 

start

public void start()

Start the sonic process

- 

refresh

public boolean refresh()
- 

createConnectionIntent

protected android.content.Intent createConnectionIntent(com.tencent.sonic.sdk.SonicDataHelper.SessionData sessionData)
- 

handleFlow_Connection

protected void handleFlow_Connection(boolean hasCache,
                                     com.tencent.sonic.sdk.SonicDataHelper.SessionData sessionData)

Initiate a network request to obtain server data. 参数:hasCache - Indicates local sonic cache is exist or not.sessionData - SessionData holds eTag templateTag

- 

handleFlow_LoadLocalCache

protected abstract void handleFlow_LoadLocalCache(java.lang.String cacheHtml)
- 

handleFlow_FirstLoad

protected abstract void handleFlow_FirstLoad()

Handle sonic first SONIC_RESULT_CODE_FIRST_LOAD logic.

- 

handleFlow_DataUpdate

protected abstract void handleFlow_DataUpdate(java.lang.String serverRsp)

Handle data update SONIC_RESULT_CODE_DATA_UPDATE logic. 参数:serverRsp - Server response data.

- 

handleFlow_TemplateChange

protected abstract void handleFlow_TemplateChange(java.lang.String newHtml)

Handle template update SONIC_RESULT_CODE_TEMPLATE_CHANGE logic. 参数:newHtml - new Html string from web-server

- 

handleFlow_HttpError

protected abstract void handleFlow_HttpError(int responseCode)
- 

handleFlow_ServiceUnavailable

protected abstract void handleFlow_ServiceUnavailable()
- 

handleFlow_NotModified

protected void handleFlow_NotModified()
- 

isPreload

public boolean isPreload()
- 

getStatistics

public[SonicSessionStatistics](../../../../com/tencent/sonic/sdk/SonicSessionStatistics.html "com.tencent.sonic.sdk中的类")getStatistics()
- 

addSessionStateChangedCallback

protected boolean addSessionStateChangedCallback([SonicSession.Callback](../../../../com/tencent/sonic/sdk/SonicSession.Callback.html "com.tencent.sonic.sdk中的接口")callback)
- 

removeSessionStateChangedCallback

protected boolean removeSessionStateChangedCallback([SonicSession.Callback](../../../../com/tencent/sonic/sdk/SonicSession.Callback.html "com.tencent.sonic.sdk中的接口")callback)
- 

addSessionCallback

public boolean addSessionCallback(com.tencent.sonic.sdk.SonicSessionCallback callback)
- 

removeSessionCallback

public boolean removeSessionCallback(com.tencent.sonic.sdk.SonicSessionCallback callback)
- 

getCurrentUrl

public java.lang.String getCurrentUrl()
- 

getFinalResultCode

public int getFinalResultCode()
- 

getSrcResultCode

public int getSrcResultCode()
- 

isDestroyedOrWaitingForDestroy

public boolean isDestroyedOrWaitingForDestroy()
- 

postForceDestroyIfNeed

protected boolean postForceDestroyIfNeed()

Destroy the session if it is waiting for destroy and it is can be destroyed. 返回:Return true if the session is waiting for destroy and it is can be destroyed.

- 

canDestroy

protected boolean canDestroy()
- 

switchState

protected boolean switchState(int fromState,
                              int toState,
                              boolean notify)
- 

onServerClosed

public void onServerClosed([SonicServer](../../../../com/tencent/sonic/sdk/SonicServer.html "com.tencent.sonic.sdk中的类")sonicServer,
                           boolean readComplete)

If the kernel obtain inputStream from a SonicSessionStream, the inputStream will be closed when the kernel reads the data.This method is invoked when the sonicSessionStream close.

If the html is read complete, sonic will separate the html to template and data, and save these data.

参数:sonicServer - The actual server connection of current SonicSession.readComplete - Whether the html is read complete.

- 

postTaskToSaveSonicCache

protected void postTaskToSaveSonicCache(java.lang.String htmlString)
- 

doSaveSonicCache

protected void doSaveSonicCache([SonicServer](../../../../com/tencent/sonic/sdk/SonicServer.html "com.tencent.sonic.sdk中的类")sonicServer,
                                java.lang.String htmlString)
- 

notifyStateChange

protected void notifyStateChange(int oldState,
                                 int newState,
                                 android.os.Bundle extraData)

When the session state changes, notify the listeners. 参数:oldState - The old state.newState - The nex state.extraData - The extra data.

- 

setResult

protected void setResult(int srcCode,
                         int finalCode,
                         boolean notify)

Record the sonic mode, notify the result to page if necessary. 参数:srcCode - The original mode.finalCode - The final mode.notify - Whether notify te result to page.

- 

bindClient

public boolean bindClient([SonicSessionClient](../../../../com/tencent/sonic/sdk/SonicSessionClient.html "com.tencent.sonic.sdk中的类")client)
- 

onClientReady

public boolean onClientReady()

Client informs sonic that it is ready. Client ready means it's webview has been initialized, can start load url or load data. 返回:True if it is set for the first time

- 

onClientRequestResource

public final java.lang.Object onClientRequestResource(java.lang.String url)

When the webview initiates a resource interception, the client invokes the method to retrieve the data 参数:url - The url of this session返回:Return the data to kernel

- 

shouldSetCookieAsynchronous

protected boolean shouldSetCookieAsynchronous()

Whether should set cookie asynchronous or not , if onClientRequestResource is calling in IOThread, it should not call set cookie synchronous which will handle in IOThread as it may cause deadlock More about it see {https://issuetracker.google.com/issues/36989494#c8} Fix VasSonic issue {https://github.com/Tencent/VasSonic/issues/90} 返回:Return the data to kernel

- 

setCookiesFromHeaders

protected boolean setCookiesFromHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
                                        boolean executeInNewThread)

Set cookies to webview from headers 参数:headers - headers from server responseexecuteInNewThread - whether execute in new thread or not返回:Set cookie success or not

- 

onRequestResource

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 参数:url - The url of this session返回:Return the data to kernel

- 

onWebReady

public boolean onWebReady([SonicDiffDataCallback](../../../../com/tencent/sonic/sdk/SonicDiffDataCallback.html "com.tencent.sonic.sdk中的接口")diffDataCallback)

Client will call this method to obtain the update data when the page shows the content. 参数:diffDataCallback - Sonic provides the latest data to the page through this callback返回:The result

- 

onClientPageFinished

public boolean onClientPageFinished(java.lang.String url)
- 

isMatchCurrentUrl

public boolean isMatchCurrentUrl(java.lang.String url)

Whether the incoming url matches the current url,it will ignore url parameters 参数:url - The incoming url.返回:Whether the incoming url matches the current url.

- 

getHeaders

protected java.util.HashMap<java.lang.String,java.lang.String> getHeaders()

Get header info with the original url of current session. 返回:The header info.

- 

getCharsetFromHeaders

protected java.lang.String getCharsetFromHeaders()

Get the charset from the latest response http header. 返回:The charset.

- 

getCharsetFromHeaders

public java.lang.String getCharsetFromHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
- 

getCacheHeaders

protected java.util.HashMap<java.lang.String,java.lang.String> getCacheHeaders()

Get header info from local cache headers 返回:The header info.

- 

getSessionClient

public[SonicSessionClient](../../../../com/tencent/sonic/sdk/SonicSessionClient.html "com.tencent.sonic.sdk中的类")getSessionClient()
- 

destroy

public void destroy()
- 

destroy

protected void destroy(boolean force)
- 

clearSessionData

protected void clearSessionData()

跳过导航链接