public class DefaultNetworkDelegate extends java.lang.Object implements NetworkDelegate
Constructor and Description |
---|
DefaultNetworkDelegate() |
Modifier and Type | Method and Description |
---|---|
boolean |
onAuthRequired(AuthRequiredParams params)
This method is invoked when a request receives an authentication challenge and is unable to respond using cached credentials.
当请求收到身份验证质询并且无法使用缓存的凭据进行响应时,将调用此方法。 |
void |
onBeforeRedirect(BeforeRedirectParams params)
This method is invoked when a server-initiated redirect is about to occur.
当服务器启动的重定向即将发生时,将调用此方法。 |
void |
onBeforeSendHeaders(BeforeSendHeadersParams params)
This method is invoked when a request is about to occur and the initial headers have been prepared.
当即将发生请求并且已经准备好初始标头时,将调用此方法。 |
void |
onBeforeSendProxyHeaders(BeforeSendProxyHeadersParams params)
The similar to
与NetworkDelegate.onBeforeSendHeaders(BeforeSendHeadersParams)方法类似。 NetworkDelegate.onBeforeSendHeaders(BeforeSendHeadersParams) method.
|
void |
onBeforeURLRequest(BeforeURLRequestParams params)
This method is invoked when a request is about to occur.
当即将发生请求时,将调用此方法。 |
boolean |
onCanGetCookies(java.lang.String url, java.util.List<Cookie> cookies)
This method is invoked when Chromium engine decides whether
当Chromium引擎决定是否可以将Cookie发送回Web服务器时,将调用此方法。 cookies can be sent back to the web server.
|
boolean |
onCanSetCookies(java.lang.String url, java.util.List<Cookie> cookies)
This method is invoked when Chromium engine decides whether
当Chromium引擎决定是否可以为URL保存cookie时,将调用此方法。 cookies can be saved for the
url or not.
|
void |
onCompleted(RequestCompletedParams params)
This method is invoked when a request has been processed successfully or failed.
请求成功或失败处理后,将调用此方法。 |
void |
onDataReceived(DataReceivedParams params)
This method is invoked each time when a part of the response body is received.
每当接收到响应主体的一部分时,都会调用此方法。 |
void |
onDestroyed(RequestParams params)
This method is invoked when a request is being destroyed.
销毁请求时将调用此方法。 |
void |
onHeadersReceived(HeadersReceivedParams params)
This method is invoked each time that an HTTP(S) response header is received.
每当接收到HTTP(S)响应标头时,都会调用此方法。 |
void |
onPACScriptError(PACScriptErrorParams params)
This method is invoked when Chromium proxy resolver failed to parse PAC script file to extract proxy settings.
当Chromium代理解析程序无法解析PAC脚本文件以提取代理设置时,将调用此方法。 |
void |
onResponseStarted(ResponseStartedParams params)
This method is invoked when the first byte of the response body is received.
当接收到响应主体的第一个字节时,将调用此方法。 |
void |
onSendHeaders(SendHeadersParams params)
This method is invoked right before the HTTP headers are sent to the network.
在HTTP标头发送到网络之前,将立即调用此方法。 |
public void onBeforeURLRequest(BeforeURLRequestParams params)
NetworkDelegate
onBeforeURLRequest
in interface
NetworkDelegate
params
- provides information about request URL and HTTP method ("GET", "POST", etc.). To override the target URL use the
RequestParams.setURL(String)
method.
-提供有关请求URL和HTTP方法的信息(“ GET”,“ POST”等)。要覆盖目标URL,请使用方法。
public void onBeforeRedirect(BeforeRedirectParams params)
NetworkDelegate
onBeforeRedirect
in interface
NetworkDelegate
params
- provides information about the current URL, new URL, HTTP method ("GET", "POST", etc.) and HTTP response code (e.g., 200, 404, and so on).
-提供有关当前URL,新URL,HTTP方法(“ GET”,“ POST”等)和HTTP响应代码(例如200、404等)的信息。
public void onBeforeSendHeaders(BeforeSendHeadersParams params)
NetworkDelegate
Note that one URL request can be split into several HTTP requests (for example to fetch individual byte ranges from a large file) or can be handled by the network stack without communicating with the network. For this reason, the event does not provide the final HTTP headers that are sent to the network. For example, all headers that are related to caching are invisible.
The following headers are currently not provided to the onBeforeSendHeaders event.
onBeforeSendHeaders
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.) and HTTP request headers.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等)和HTTP请求标头的信息。
public void onSendHeaders(SendHeadersParams params)
NetworkDelegate
onSendHeaders
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.) and HTTP request headers. HTTP headers overriding has no effect.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等)和HTTP请求标头的信息。 HTTP标头覆盖无效。
public void onHeadersReceived(HeadersReceivedParams params)
NetworkDelegate
This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
onHeadersReceived
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.) and HTTP request headers.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等)和HTTP请求标头的信息。
public void onResponseStarted(ResponseStartedParams params)
NetworkDelegate
This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
onResponseStarted
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.) and HTTP response code.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等)和HTTP响应代码的信息。
public void onDataReceived(DataReceivedParams params)
NetworkDelegate
NetworkDelegate.onCompleted(RequestCompletedParams)
method will be fired. This event is informational.
Note that Mime-Type
and Charset
, provided by DataReceivedParams
, are taken from response headers and may be overridden by NetworkDelegate.onHeadersReceived(HeadersReceivedParams)
method.
onDataReceived
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.), Mime-Type, and response data.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等),Mime-Type和响应数据的信息。
public void onCompleted(RequestCompletedParams params)
NetworkDelegate
RequestCompletedParams.getStatus()
method. If HTTP request status is
RequestStatus.FAILED
, you can get information about network error using the
RequestCompletedParams.getErrorCode()
method.
onCompleted
in interface
NetworkDelegate
params
- provides information about request URL, HTTP method ("GET", "POST", etc.), request status, response code and network error code.
-提供有关请求URL,HTTP方法(“ GET”,“ POST”等),请求状态,响应代码和网络错误代码的信息。
public void onDestroyed(RequestParams params)
NetworkDelegate
onDestroyed
in interface
NetworkDelegate
params
- provides information about request.
-提供有关请求的信息。
public boolean onAuthRequired(AuthRequiredParams params)
NetworkDelegate
FYI: to test "basic" or "digest" authentication you can use http://test.webdav.org/
onAuthRequired
in interface
NetworkDelegate
params
- the authentication challenge information such as authentication scheme, URL etc. Use
AuthRequiredParams.setUsername(String)
and
AuthRequiredParams.setPassword(String)
to provide authentication credentials.
-身份验证质询信息,例如身份验证方案,URL等。使用和提供身份验证凭据。
true
when authentication must be canceled.
何时必须取消身份验证。
public boolean onCanSetCookies(java.lang.String url, java.util.List<Cookie> cookies)
NetworkDelegate
cookies
can be saved for the
url
or not. Return
true
to allow engine to save the cookies. If you return
false
, the cookies will not be saved and will not be available in
CookieStorage
.
If this method throws an exception, then default behavior will be applied - the method returns true
.
onCanSetCookies
in interface
NetworkDelegate
url
- a string representation of the URL associated with the
cookies
.
-与关联的URL的字符串表示形式。
cookies
- a list of cookies to apply.
-要应用的Cookie列表。
true
to allow saving cookies.
允许保存cookie。
public boolean onCanGetCookies(java.lang.String url, java.util.List<Cookie> cookies)
NetworkDelegate
cookies
can be sent back to the web server. Return
true
to allow cookies to be sent to the web server.
If this method throws an exception, then default behavior will be applied - the method returns true
.
onCanGetCookies
in interface
NetworkDelegate
url
- a string representation of the URL associated with the
cookies
.
-与关联的URL的字符串表示形式。
cookies
- a list of cookies to send.
-要发送的Cookie列表。
true
to allow sending cookies.
允许发送cookie。
public void onBeforeSendProxyHeaders(BeforeSendProxyHeadersParams params)
NetworkDelegate
NetworkDelegate.onBeforeSendHeaders(BeforeSendHeadersParams)
method. Fires when proxy connection is used, after
onBeforeSendHeaders
method is invoked. Provides information about proxy connection, and also allows adding, modifying, and deleting HTTP request headers.
onBeforeSendProxyHeaders
in interface
NetworkDelegate
public void onPACScriptError(PACScriptErrorParams params)
NetworkDelegate
onPACScriptError
in interface
NetworkDelegate
params
- details about PAC script error such as line number and error message.
-有关PAC脚本错误的详细信息,例如行号和错误消息。