* Service for plugins to periodically retrieve update data files
* (like the one in the update center) through browsers.
...
...
@@ -62,6 +66,9 @@ public class DownloadService extends PageDecorator {
* Builds up an HTML fragment that starts all the download jobs.
*/
publicStringgenerateFragment(){
if(!DownloadSettings.get().isUseBrowser()){
return"";
}
if(neverUpdate)return"";
if(doesNotSupportPostMessage())return"";
...
...
@@ -135,6 +142,34 @@ public class DownloadService extends PageDecorator {
returnnull;
}
/**
* Loads JSON from a JSONP URL.
* Metadata for downloadables and update centers is offered in two formats, both designed for download from the browser (predating {@link DownloadSettings}):
* HTML using {@code postMessage} for newer browsers, and JSONP as a fallback.
* Confusingly, the JSONP files are given the {@code *.json} file extension, when they are really JavaScript and should be {@code *.js}.
* This method extracts the JSON from a JSONP URL, since that is what we actually want when we download from the server.
* (Currently the true JSON is not published separately, and extracting from the {@code *.json.html} is more work.)
* @param src a URL to a JSONP file (typically including {@code id} and {@code version} query parameters)
* @return the embedded JSON text
* @throws IOException if either downloading or processing failed