Is there a response that practically states "hang on whilst we're downloading
this image, I'll let you get back to it later, in the meantime go on to the
next resource" ?
? No. This API is suggested to be used synchronously. You need to return
WebResourceResponse asap.
If the answer to my first question is "no", is it possible to alter the URL to
the resource and then have XWalkView download it ?
? I did several experiments, cannot alter the url. I do not know your user
case, but this will be weird to users. BTW, you can alter the url to a local
page like this:
private static final String RESTRICTED = "<html><body>not
allowed</body></html>";
@Override
public WebResourceResponse shouldInterceptLoadRequest(XWalkView view,
String url) {
try {
return new
WebResourceResponse("text/html","UTF-8",
new
ByteArrayInputStream(RESTRICTED.getBytes("UTF-8")));
}
catch (Exception ex) {
Log.e(TAG, "Bad file" + ex.toString());
}
return null;
}
From: Crosswalk-help
[mailto:[email protected]] On Behalf Of
Alexander Biemann
Sent: Tuesday, April 21, 2015 7:36 AM
To: [email protected]
Subject: [Crosswalk-help] [crosswalk-help] How is it possible to async download
images from shouldInterceptLoadRequest() ?
My app intercepts the shouldInterceptLoadRequest() and needs to download
graphics asynchronously so that multiple images don't download one after
another, but mostly in parallel.
public WebResourceResponse shouldInterceptLoadRequest
(XWalkView<https://crosswalk-project.org/apis/embeddingapidocs/reference/org/xwalk/core/XWalkView.html>
view, String url)
My initial idea is to have my app start multiple download threads, however,
after the URL is handed off to the download thread there needs to be some kind
of returned data in the WebResourceResponse.
Is there a response that practically states "hang on whilst we're downloading
this image, I'll let you get back to it later, in the meantime go on to the
next resource" ?
I would return null, so that XWalkView can download it (hopefully
asynchronously - I haven't tested it), but the URL has to be altered so that
the resource can be downloaded.
If the answer to my first question is "no", is it possible to alter the URL to
the resource and then have XWalkView download it ?
Thanks !
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help