@Extension public class DownloadService extends PageDecorator
Because the retrieval of the file goes through XmlHttpRequest, we cannot reliably pass around binary.
Modifier and Type | Class and Description |
---|---|
static class |
DownloadService.Downloadable
Represents a periodically updated JSON data file obtained from a remote URL.
|
static class |
DownloadService.DownloadableListener
This installs itself as a listener to changes to the Downloadable extension list and will download the metadata
for any newly added Downloadables.
|
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static boolean |
neverUpdate |
static boolean |
signatureCheck
May be used to temporarily disable signature checking on
DownloadService and UpdateCenter . |
ALL
clazz
Constructor and Description |
---|
DownloadService() |
Modifier and Type | Method and Description |
---|---|
String |
generateFragment()
Builds up an HTML fragment that starts all the download jobs.
|
DownloadService.Downloadable |
getById(String id)
Gets
DownloadService.Downloadable by its ID. |
static String |
loadJSON(URL src)
Loads JSON from a JSONP URL.
|
static String |
loadJSONHTML(URL src)
Loads JSON from a JSON-with-
postMessage URL. |
all, getDescriptor, getUrl
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, findByDescribableClassName, findById, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
public static boolean neverUpdate
public static boolean signatureCheck
DownloadService
and UpdateCenter
.
Useful when upstream signatures are broken, such as due to expired certificates.
Should only be used when DownloadSettings.isUseBrowser()
;
disabling signature checks for in-browser downloads is very dangerous as unprivileged users could submit spoofed metadata!public String generateFragment()
public DownloadService.Downloadable getById(String id)
DownloadService.Downloadable
by its ID.
Used to bind them to URL.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String loadJSON(URL src) throws IOException
DownloadSettings
):
HTML using postMessage
for newer browsers, and JSONP as a fallback.
Confusingly, the JSONP files are given the *.json
file extension, when they are really JavaScript and should be *.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 *.json.html
is more work.)src
- a URL to a JSONP file (typically including id
and version
query parameters)IOException
- if either downloading or processing failed@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String loadJSONHTML(URL src) throws IOException
postMessage
URL.src
- a URL to a JSON HTML file (typically including id
and version
query parameters)IOException
- if either downloading or processing failedCopyright © 2018. All rights reserved.