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 classDownloadService.DownloadableRepresents a periodically updated JSON data file obtained from a remote URL.static classDownloadService.DownloadableListenerThis 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 booleanneverUpdatestatic booleansignatureCheckMay be used to temporarily disable signature checking onDownloadServiceandUpdateCenter.
-
Constructor Summary
Constructors Constructor Description DownloadService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringgenerateFragment()Deprecated.browser-based download has been disabledDownloadService.DownloadablegetById(String id)GetsDownloadService.Downloadableby its ID.static StringloadJSON(URL src)Loads JSON from a JSONP URL.static StringloadJSONHTML(URL src)Loads JSON from a JSON-with-postMessageURL.
-
-
-
Field Detail
-
neverUpdate
public static boolean neverUpdate
-
signatureCheck
public static boolean signatureCheck
May be used to temporarily disable signature checking onDownloadServiceandUpdateCenter. 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.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
-
-