Java Code Examples for android.webkit.WebResourceResponse#getReasonPhrase()

The following examples show how to use android.webkit.WebResourceResponse#getReasonPhrase() . 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: WebPlayerView.java    From unity-ads-android with Apache License 2.0 6 votes vote down vote up
@TargetApi(21)
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
	if (shouldCallSuper("onReceivedHttpError")) {
		super.onReceivedHttpError(view, request, errorResponse);
	}
	if (shouldSendEvent("onReceivedHttpError")) {
		String url = "";
		if (request != null && request.getUrl() != null) {
			url = request.getUrl().toString();
		}

		int statusCode = -1;
		String reasonPhrase = "";
		if (errorResponse != null) {
			statusCode = errorResponse.getStatusCode();
			reasonPhrase = errorResponse.getReasonPhrase();
		}

		WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.HTTP_ERROR, url, reasonPhrase, statusCode, viewId);
	}
}
 
Example 2
Source File: CommonRefreshWebViewActivity.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
    super.onReceivedHttpError(view, request, errorResponse);
    String errRespStr = "";
    if (errorResponse != null) {
        if (Util.isCompateApi(21)) {
            errRespStr += "status code =" + errorResponse.getStatusCode() + " | reason : " + errorResponse.getReasonPhrase();
        }
    }
    e(null, "--> onReceivedHttpError() request url = " + request.getUrl() + "  errRespStr = " + errRespStr);
}