com.atlassian.plugin.webresource.WebResourceManager |
![]() |
Manage 'css', 'javascript' and other 'resources' that are usually linked at the top of pages using <script>
and <link>
tags.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
WebResourceManager.IncludeMode | This interface is deprecated. Since 2.2 |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DELAYED_INCLUDE_MODE |
This field is deprecated.
Since 2.2. Use requireResource(String, Writer, UrlMode) instead.
|
||||||||||
INLINE_INCLUDE_MODE |
This field is deprecated.
Since 2.2. Use requireResource(String) instead.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Executes a Supplier within a new WebResourceManager context.
| |||||||||||
This is the equivalent of calling
getRequiredResources(UrlMode, WebResourceFilter) with the given url
mode and a default filter that is dependent on the implementation. | |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getRequiredResources(UrlMode)
| |||||||||||
Returns the resource tags for the previously required resources called via
requireResource(String) that
match the specified web resource filter. | |||||||||||
Returns the resource tags of the specified resource.
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getResourceTags(String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.9.0, replaced by
getStaticPluginResourceUrl(com.atlassian.plugin.ModuleDescriptor, String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getStaticPluginResource(String, String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getStaticPluginResource(ModuleDescriptor, String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.9.0, replaced by
getStaticPluginResourceUrl(String, String, UrlMode)
| |||||||||||
This method is deprecated.
Since 2.2 Use #getStaticPluginResource instead
| |||||||||||
This method is deprecated.
As of 2.9.0, replaced by
getStaticResourcePrefix(String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getStaticResourcePrefix(String, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.9.0, replaced by
getStaticResourcePrefix(UrlMode)
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
getStaticResourcePrefix(UrlMode)
| |||||||||||
This is the equivalent of calling
includeResources(Writer, UrlMode, WebResourceFilter) with
the given url mode and a default web resource filter that is dependent on the implementation. | |||||||||||
Writes out the resource tags to the previously required resources called via
requireResource(String) for
the specified resource type. | |||||||||||
Writes out the resource tags for a specified set of required resources and their dependencies.
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
includeResources(Writer, UrlMode)
| |||||||||||
This method is deprecated.
As of 2.3.0, replaced by
requireResource(String, Writer, UrlMode)
| |||||||||||
Indicates that a given plugin web resource is required.
| |||||||||||
Writes the resource tags of the specified resource to the writer.
| |||||||||||
Writes the resource tags of all resources that have the given context specified in their descriptor.
| |||||||||||
This method is deprecated.
Since 2.2.
|
Executes a Supplier within a new WebResourceManager context. The request-local state manipulated by requireResource
and requireResourcesForContext is preserved, an empty state is initialized for the execution of nestedExecution and
after the nestedExecution is run, the old state is restored.
If no return is required from the nestedExecution then Suppier
nestedExecution | the code to be executed in the empty context. |
---|
This is the equivalent of calling getRequiredResources(UrlMode, WebResourceFilter)
with the given url
mode and a default filter that is dependent on the implementation.
Returns the resource tags for the previously required resources called via requireResource(String)
that
match the specified web resource filter. If you are outputting the value to a Writer
, use
includeResources(Writer, UrlMode)
.
<script type="text/javascript" src="$contextPath/scripts/javascript.js"></script>Similarly for other supported resources. This method formats resource URLs in either relative or absolute format, depending on the value of
urlMode
. See UrlMode
for details of the different options for URL format.
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
---|---|
webResourceFilter | the web resource filter to filter resources on |
Returns the resource tags of the specified resource. If you are outputting the value to a Writer
, use
requireResource(String, java.io.Writer, UrlMode)
.
urlMode
. See UrlMode
for details of the different options for URL format.moduleCompleteKey | The fully qualified plugin web resource module (eg jira.webresources:scriptaculous ) |
---|---|
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
This method is deprecated.
As of 2.9.0, replaced by getStaticPluginResourceUrl(com.atlassian.plugin.ModuleDescriptor, String, UrlMode)
A helper method to return a url for 'plugin' resources. Generally the implementation will return
/s/{build num
/{system counter}/{plugin version}/_/download/resources/plugin.key:module.key/resource.name}
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/download/resources/plugin.key:module.key/resource.name
with <%=
webResourceManager.getStaticPluginResource(descriptor, resourceName) %>
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode
.
See UrlMode
for details of the different options for URL format.moduleDescriptor | plugin module descriptor that contains the resource |
---|---|
resourceName | the name of the resource as defined in the plugin manifest |
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
This method is deprecated.
As of 2.3.0, replaced by getStaticPluginResource(String, String, UrlMode)
This method is deprecated.
As of 2.3.0, replaced by getStaticPluginResource(ModuleDescriptor, String, UrlMode)
This method is deprecated.
As of 2.9.0, replaced by getStaticPluginResourceUrl(String, String, UrlMode)
A helper method to return a url for 'plugin' resources. Generally the implementation will return
/s/{build num
/{system counter}/{plugin version}/_/download/resources/plugin.key:module.key/resource.name}
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/download/resources/plugin.key:module.key/resource.name
with <%=
webResourceManager.getStaticPluginResource(descriptor, resourceName) %>
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode
.
See UrlMode
for details of the different options for URL format.moduleCompleteKey | complete plugin module key |
---|---|
resourceName | the name of the resource as defined in the plugin manifest |
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
This method is deprecated.
Since 2.2 Use #getStaticPluginResource instead
This method is deprecated.
As of 2.9.0, replaced by getStaticResourcePrefix(String, UrlMode)
A helper method to return a prefix for 'system' static resources. This method should be used for resources that change more frequently than system resources, and therefore have their own resource counter.
Generally the implementation will return/s/{build num
/{system counter}/{resource counter}/_}
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/styles/global.css
with <%= webResourceManager.getStaticResourcePrefix(resourceCounter)
%>/styles/global.css
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode
.
See UrlMode
for details of the different options for URL format.resourceCounter | A number that represents the unique version of the resource you require. Every time this resource changes, you need to increment the resource counter |
---|---|
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
This method is deprecated.
As of 2.9.0, replaced by getStaticResourcePrefix(UrlMode)
A helper method to return a prefix for 'system' static resources. Generally the implementation will return
/s/{build num
/{system counter}/_}
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/styles/global.css
with <%= webResourceManager.getStaticResourcePrefix()
%>/styles/global.css
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode
.
See UrlMode
for details of the different options for URL format.urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
---|
This is the equivalent of calling includeResources(Writer, UrlMode, WebResourceFilter)
with
the given url mode and a default web resource filter that is dependent on the implementation.
Writes out the resource tags to the previously required resources called via requireResource(String)
for
the specified resource type. If you need it as a String to embed the tags in a template, use
getRequiredResources(UrlMode)
.
<script type="text/javascript" src="$contextPath/scripts/javascript.js"></script>Similarly for other supported resources. This method formats resource URLs in either relative or absolute format, depending on the value of
urlMode
. See UrlMode
for details of the different options for URL format.writer | the writer to write the links to |
---|---|
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
webResourceFilter | the web resource filter to filter resources on |
Writes out the resource tags for a specified set of required resources and their dependencies. Does not write out
tags for resources specified in calls to requireResource(String)
.
moduleCompleteKeys | The set of web resource modules to include |
---|---|
writer | the writer to write the links to |
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
Indicates that a given plugin web resource is required. All resources called via this method must be included
when includeResources(Writer)
is called.
moduleCompleteKey | The fully qualified plugin web resource module (eg jira.webresources:scriptaculous ) |
---|
Writes the resource tags of the specified resource to the writer. If you need it as a String to embed the tags in
a template, use getResourceTags(String, UrlMode)
.
urlMode
. See UrlMode
for details of the different options for URL format.moduleCompleteKey | The fully qualified plugin web resource module (eg jira.webresources:scriptaculous ) |
---|---|
writer | The writer to write the resource tags to. |
urlMode | specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide |
Writes the resource tags of all resources that have the given context specified in their descriptor.
context | The name of the context for which you want to require resources (eg "atl.admin") |
---|