Last updated Mar 13, 2024

Downloadable Plugin Resources

Available:

Bamboo 2.3 and later

Description

Bamboo plugins may define downloadable resources. If your plugin requires Bamboo to include additional static files such as images, Javascript or CSS, you will need to use downloadable plugin resources to make them available. However, we recommend that you consider defining Javascript and CSS files as Web Resources instead. Web resources are included in the header of a page and can take advantage of caching (i.e. only download a resource if it has changed) and batching (i.e. serve multiple files in one request).

Please see the Web Resources documentation, if you want to include Javascript or CSS files for download from the header of a page.

Defining a Single Downloadable Resource

Downloadable resources are configured to map a name of some downloadable file to its location within the plugin jar-file.

1
2
<resource type="download" name="icn_auto_fav.gif" location="icn_auto_fav.gif"/>
  • Resources can be downloaded either within a plugin module, or as a resource of the entire plugin.
    • Resources are always looked up relative to a plugin module (see BAMBOO:below). If a resource can not be found in the plugin module, it will then be looked for in the plugin itself.
  • Each resource must be of type="download"
  • The name of the resource is how it will be referenced from within the application
  • The location of the resource is where it appears within the plugin itself
  • An optional content-type parameter can be used to supply the file's MIME type
    • In the absence of a content-type, the application will attempt to guess the file's type from its file extension. For common file extensions, an explicit content-type is not necessary.

Defining a Directory of Downloadable Resources

If your plugin requires a lot of resources, you may wish to expose a directory of files as resources, rather than writing definitions for each individual file.

1
2
<resource type="download" name="icons/" location="templates/extra/autofavourite/icons/"/>
  • The name and location must both have trailing slashes
  • Subdirectories are also exposed, so in the example above, icons/small/icn_auto_fav.gif will be mapped to the resource templates/extra/autofavourite/icons/small/icn_auto_fav.gif

Referring to Downloadable Resources

The URL for a downloadable resource is as follows: {server root}/download/resources/{plugin key}:{module key}/{resource name}

{module key} is optional.

For example:

com.atlassian.bamboo.plugin.autofavourite:autofavourite-resources/icn_auto_fav.gif

Rate this page: