标签: android ajax webview http-headers webviewclient
我覆盖了public WebResourceResponse shouldInterceptRequest(WebView webView, String url),它应该根据Ajax函数的请求返回自定义响应。但看起来WebResourceResponse只包含响应正文。我怎样才能像这样传递HTTP响应:
public WebResourceResponse shouldInterceptRequest(WebView webView, String url)
Ajax
WebResourceResponse
HTTP/1.1 202 Cache-Control: no-cache Custom-param: param
到我的WebView?
WebView
答案 0 :(得分:0)
从Android API 21开始,WebResourceResponse.html#setStatusCodeAndReasonPhrase()和WebResourceResponse.html#setResponseHeaders()方法可用。