Package hudson.model
Class DownloadService
java.lang.Object
hudson.model.DownloadService
Service for plugins to periodically retrieve update data files
(like the one in the update center) through browsers.
Because the retrieval of the file goes through XmlHttpRequest, we cannot reliably pass around binary.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a periodically updated JSON data file obtained from a remote URL.static class
This installs itself as a listener to changes to the Downloadable extension list and will download the metadata for any newly added Downloadables. -
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
static boolean
May be used to temporarily disable signature checking onDownloadService
andUpdateCenter
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.browser-based download has been disabledGetsDownloadService.Downloadable
by its ID.static String
Loads JSON from a JSONP URL.static String
loadJSONHTML
(URL src) Loads JSON from a JSON-with-postMessage
URL.
-
Field Details
-
neverUpdate
public static boolean neverUpdate -
signatureCheck
public static boolean signatureCheckMay be used to temporarily disable signature checking onDownloadService
andUpdateCenter
. Useful when upstream signatures are broken, such as due to expired certificates.
-
-
Constructor Details
-
DownloadService
public DownloadService()
-
-
Method Details
-
generateFragment
Deprecated.browser-based download has been disabledBuilds up an HTML fragment that starts all the download jobs. -
getById
GetsDownloadService.Downloadable
by its ID. Used to bind them to URL. -
loadJSON
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String loadJSON(URL src) throws IOException Loads JSON from a JSONP URL. Metadata for downloadables and update centers is offered in two formats, both designed for download from the browser (a feature since removed): HTML usingpostMessage
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.)- Parameters:
src
- a URL to a JSONP file (typically includingid
andversion
query parameters)- Returns:
- the embedded JSON text
- Throws:
IOException
- if either downloading or processing failed
-
loadJSONHTML
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String loadJSONHTML(URL src) throws IOException Loads JSON from a JSON-with-postMessage
URL.- Parameters:
src
- a URL to a JSON HTML file (typically includingid
andversion
query parameters)- Returns:
- the embedded JSON text
- Throws:
IOException
- if either downloading or processing failed
-