-1
我想攔截blobservice在我的Android應用程序的請求攔截Blob存儲請求和保存響應文件
到URL看起來像這樣: http://foo.appspot.com/simpleams/blobservice?blob-key=AMIfv94NAAoxn1oi_ySWYSiNF3MforFVI6SvDi_NeF0rjNr_QW
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if(url.contains("blobservice")) {
return getAppWebResourceResponseFromBlobstore(view, url);
} else {
return super.shouldInterceptRequest(view, url);
}
}
private WebResourceResponse getAppWebResourceResponseFromBlobstore(WebView view, String url) {
try {
// TODO:
return file from local data or download it from
blob service, save it and return it...
} catch (IOException e) {
return null;
}
}
我怎樣才能使請求到服務器並在本地保存文件?