Package hudson.model
Class DownloadService
- java.lang.Object
-
- hudson.model.DownloadService
-
@Extension public class DownloadService extends Object
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 Classes Modifier and Type Class 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.
-
Field Summary
Fields Modifier and Type Field Description static boolean
neverUpdate
static boolean
signatureCheck
May be used to temporarily disable signature checking onDownloadService
andUpdateCenter
.
-
Constructor Summary
Constructors Constructor Description DownloadService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
generateFragment()
Deprecated.browser-based download has been disabledDownloadService.Downloadable
getById(String id)
GetsDownloadService.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.
-
-
-
Field Detail
-
neverUpdate
public static boolean neverUpdate
-
signatureCheck
public static boolean signatureCheck
May be used to temporarily disable signature checking onDownloadService
andUpdateCenter
. Useful when upstream signatures are broken, such as due to expired certificates.
-
-
Method Detail
-
generateFragment
@Deprecated public String generateFragment()
Deprecated.browser-based download has been disabledBuilds up an HTML fragment that starts all the download jobs.
-
getById
public DownloadService.Downloadable getById(String id)
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
-
-