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
  • Field Details

    • neverUpdate

      public static boolean neverUpdate
    • signatureCheck

      public static boolean signatureCheck
      May be used to temporarily disable signature checking on DownloadService and UpdateCenter. Useful when upstream signatures are broken, such as due to expired certificates.
  • Constructor Details

    • DownloadService

      public DownloadService()
  • Method Details

    • generateFragment

      @Deprecated public String generateFragment()
      Deprecated.
      browser-based download has been disabled
      Builds up an HTML fragment that starts all the download jobs.
    • getById

      public DownloadService.Downloadable getById(String id)
      Gets DownloadService.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 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.)
      Parameters:
      src - a URL to a JSONP file (typically including id and version 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 including id and version query parameters)
      Returns:
      the embedded JSON text
      Throws:
      IOException - if either downloading or processing failed