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
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a periodically updated JSON data file obtained from a remote URL.static classThis installs itself as a listener to changes to the Downloadable extension list and will download the metadata for any newly added Downloadables. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanstatic booleanMay be used to temporarily disable signature checking onDownloadServiceandUpdateCenter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.browser-based download has been disabledGetsDownloadService.Downloadableby its ID.static StringLoads JSON from a JSONP URL.static StringloadJSONHTML(URL src) Loads JSON from a JSON-with-postMessageURL.
-
Field Details
-
neverUpdate
public static boolean neverUpdate -
signatureCheck
public static boolean signatureCheckMay be used to temporarily disable signature checking onDownloadServiceandUpdateCenter. 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.Downloadableby 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 usingpostMessagefor newer browsers, and JSONP as a fallback. Confusingly, the JSONP files are given the*.jsonfile 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.htmlis more work.)- Parameters:
src- a URL to a JSONP file (typically includingidandversionquery 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-postMessageURL.- Parameters:
src- a URL to a JSON HTML file (typically includingidandversionquery parameters)- Returns:
- the embedded JSON text
- Throws:
IOException- if either downloading or processing failed
-