android.net.http.SslError#getUrl ( )源码实例Demo

下面列出了android.net.http.SslError#getUrl ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: unity-ads-android   文件: WebPlayerView.java
@TargetApi(14)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
	// Don't call shouldCallSuper("onReceivedSslError") to ensure
	// we always rely on the default behavior.  Otherwise it is
	// possible Google might reject the app as an unsafe implementation.
	// https://support.google.com/faqs/answer/7071387?hl=en
	super.onReceivedSslError(view, handler, error);
	DeviceLog.error("Received SSL error for '%s': %s", error.getUrl(), error.toString());

	if (shouldSendEvent("onReceivedSslError")) {
		String url = "";
		if (error != null) {
			url = error.getUrl();
		}
		WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.SSL_ERROR, url, viewId);
	}
}
 
源代码2 项目: DeviceConnect-Android   文件: WebViewActivity.java
@Override
public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) {
    int primaryError = error.getPrimaryError();
    String url = error.getUrl();
    SslCertificate cert = error.getCertificate();
    mLogger.warning("onReceivedSslError: error = " + primaryError
            + ", url = " + url + ", certificate = " + cert);

    if (primaryError == SslError.SSL_UNTRUSTED && url != null && cert != null) {
        SslCertificate.DName subjectName = cert.getIssuedTo();
        if (subjectName != null
                && "localhost".equals(subjectName.getCName())
                && url.startsWith("https://localhost") ) {
            handler.proceed();
            mLogger.warning("SSL Proceeded: url = " + url);
            return;
        }
    }
    handler.cancel();
    mLogger.severe("SSL Canceled: url = " + url);
}