0
我有Android应用程序,它使用webview来显示Google App Engine网络应用程序。如何覆盖在我的应用程序中遇到的默认HTTP Error 504 Gateway timeout
?Android Webview - HTTP错误504网关超时
HTTP Error 504 Gateway timeout
The server, while acting as a gateway or proxy, did not receive a
timely response from the upstream server it accessed in attempting
to complete the request.
我已经覆盖onReceivedError
哪些工作时没有互联网连接可用和其他错误。
webView.setWebViewClient(new WebViewClient(){
...
@SuppressLint("DefaultLocale")
@Override
public void onReceivedError(WebView view, int errorCode,String description, String failingUrl) {
try {
String template = streamToString(getAssets().open("html/error.html"));
String data = template.replaceAll("%DESCRIPTION%", description.toLowerCase())
.replaceAll("%WEBSITE_URL%", WEBSITE_URL);
view.loadDataWithBaseURL("file:///android_asset/html/", data, "text/html", "utf-8", null);
} catch (IOException e) {
e.printStackTrace();
}
}
});
onReceivedError
只能收到HTTP错误网络错误?任何解决方法? android webview如何拦截HTTP错误?
'onReceivedError'不当错误发生时调用,而是显示一个默认的错误页面。 –
这是否会一直发生?\ – Nezam
现在试试我的编辑 – Nezam