com.tencent.smtt.export.external.interfaces.SslError Java Examples

The following examples show how to use com.tencent.smtt.export.external.interfaces.SslError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X5WebViewClient.java    From x5webview-cordova-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example #2
Source File: X5WebViewClient.java    From cordova-plugin-x5-tbs with Apache License 2.0 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view    The WebView that is initiating the callback.
 * @param handler An SslErrorHandler object that will handle the user's response.
 * @param error   The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

  final String packageName = parentEngine.cordova.getActivity().getPackageName();
  final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

  ApplicationInfo appInfo;
  try {
    appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
    if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
      // debug = true
      handler.proceed();
      return;
    } else {
      // debug = false
      super.onReceivedSslError(view, handler, error);
    }
  } catch (NameNotFoundException e) {
    // When it doubt, lock it out!
    super.onReceivedSslError(view, handler, error);
  }
}
 
Example #3
Source File: X5WebViewClient.java    From YCWebView with Apache License 2.0 6 votes vote down vote up
/**
 * 在加载资源时通知主机应用程序发生SSL错误
 * 作用:处理https请求
 *      webView加载一些别人的url时候,有时候会发生证书认证错误的情况,这时候希望能够正常的呈现页面给用户,
 *      我们需要忽略证书错误,需要调用WebViewClient类的onReceivedSslError方法,
 *      调用handler.proceed()来忽略该证书错误。
 * @param view                              view
 * @param handler                           handler,表示一个处理SSL错误的请求,提供了方法操作(proceed/cancel)请求
 * @param error                             error
 */
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    super.onReceivedSslError(view, handler, error);
    X5LogUtils.i("-------onReceivedSslError-------"+ error.getUrl());
    if (error!=null){
        String url = error.getUrl();
        if (webListener!=null){
            webListener.showErrorView(X5WebUtils.ErrorMode.SSL_ERROR);
        }
        X5LogUtils.i("onReceivedSslError----异常url----"+url);
    }
    //https忽略证书问题
    if (handler!=null){
        //表示等待证书响应
        handler.proceed();
        // handler.cancel();      //表示挂起连接,为默认方式
        // handler.handleMessage(null);    //可做其他处理
    }
}
 
Example #4
Source File: X5WebViewClient.java    From cordova-plugin-x5engine-webview with Apache License 2.0 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example #5
Source File: WrapperWebViewClient.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
                               SslError error) {
    if(mWebViewClient!=null){
        mWebViewClient.onReceivedSslError(view,handler,error);
        return;
    }
    super.onReceivedSslError(view,handler,error);
}
 
Example #6
Source File: BridgeWebViewClient.java    From JsBridge with MIT License 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
    boolean interrupt = false;
    if (bridgeWebViewClientListener != null) {
        interrupt = bridgeWebViewClientListener.onReceivedSslError(webView, sslErrorHandler, sslError);
    }
    if (!interrupt) {
        super.onReceivedSslError(webView, sslErrorHandler, sslError);
    }
}
 
Example #7
Source File: x5_MainActivity.java    From styT with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
    super.onReceivedSslError(view, handler, error);
}
 
Example #8
Source File: MyTestActivity.java    From AndroidFrame with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
    Log.e(LOG_TAG, "------------onReceivedSslError----------");
    sslErrorHandler.proceed();
}
 
Example #9
Source File: CrazyDailyWebView.java    From CrazyDaily with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler handler, SslError sslError) {
    handler.proceed();//处理证书
}
 
Example #10
Source File: SimpleBridgeWebViewClientListener.java    From JsBridge with MIT License 4 votes vote down vote up
@Override
public boolean onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
    return false;
}
 
Example #11
Source File: MyX5WebViewClient.java    From ByWebView with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed(); //解决方案, 不要调用super.xxxx
}
 
Example #12
Source File: CBrowserWindow7.java    From appcan-android with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
                               SslError error) {

    handler.proceed();
}
 
Example #13
Source File: CBrowserWindow.java    From appcan-android with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
}
 
Example #14
Source File: BridgeWebViewClientListener.java    From JsBridge with MIT License votes vote down vote up
boolean onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError);