<link> tags.
By using the WebResourceManager, components can declare dependencies on javascript and css that they would
otherwise have to embed inline (which means that it can't be cached, and are often duplicated in a page).
DELAYED_INCLUDE_MODE
static final WebResourceManager.IncludeMode DELAYED_INCLUDE_MODE
- Deprecated. Since 2.2. Use
#writeResourceTags(String, Writer)
instead.
INLINE_INCLUDE_MODE
static final WebResourceManager.IncludeMode INLINE_INCLUDE_MODE
- Deprecated. Since 2.2. Use
requireResource(String)
instead.
requireResource
void requireResource(java.lang.String moduleCompleteKey)
- Indicates to that a given plugin web resource is required. All resources called via this method must be
included when
includeResources(Writer)
is called.
- Parameters:
moduleCompleteKey
- The fully qualified plugin web resource module (eg jira.webresources:scriptaculous
)- See Also:
includeResources(Writer)
includeResources
void includeResources(java.io.Writer writer)
- Writes out the resource tags to the previously required resources called via
requireResource(String)
.
If you need it as a String to embed the tags in a template, use getRequiredResources()
.
Example - if a 'javascript' resource has been required earlier with requireResource(), this method should output:
<script type="text/javascript" src="$contextPath/scripts/javascript.js"></script>
Similarly for other supported resources
- Parameters:
writer
- The writer to write the links to
getRequiredResources
java.lang.String getRequiredResources()
- See Also:
#includeResources(Writer)}
requireResource
void requireResource(java.lang.String moduleCompleteKey,
java.io.Writer writer)
- 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
getRequiredResources()
.
- Parameters:
moduleCompleteKey
- The fully qualified plugin web resource module (eg jira.webresources:scriptaculous
)writer
- The writer to write the resource tags to.
getResourceTags
java.lang.String getResourceTags(java.lang.String moduleCompleteKey)
- Since:
- 2.2
- See Also:
#requireResource(String, Writer)}
getStaticResourcePrefix
java.lang.String getStaticResourcePrefix()
- 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
- Returns:
- A prefix that can be used to prefix 'static system' resources.
getStaticResourcePrefix
java.lang.String getStaticResourcePrefix(java.lang.String resourceCounter)
- 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
- Parameters:
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
- Returns:
- A prefix that can be used to prefix 'static system' resources.
getStaticPluginResource
java.lang.String getStaticPluginResource(java.lang.String moduleCompleteKey,
java.lang.String resourceName)
- 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) %>
- Parameters:
moduleCompleteKey
- complete plugin module key
- Returns:
- A url that can be used to request 'plugin' resources.
getStaticPluginResource
java.lang.String getStaticPluginResource(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
- Parameters:
pluginModuleKey
- complete plugin module key
- Returns:
- returns the url of this plugin resource
- See Also:
#getStaticPluginResource(String, String)}
getStaticPluginResourcePrefix
java.lang.String getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
- Deprecated. Use #getStaticPluginResource instead
setIncludeMode
void setIncludeMode(WebResourceManager.IncludeMode includeMode)
- Deprecated. Since 2.2.
- Whether resources should be included inline, or at the top of the page. In most cases, you want to leave this
as the default. However, for pages that don't have a decorator, you will not be able to 'delay' including
the resources (css, javascript), and therefore need to include them directly inline.
- Parameters:
includeMode
- If there is no decorator for this request, set this to be INLINE_INCLUDE_MODE
- See Also:
DELAYED_INCLUDE_MODE
,
INLINE_INCLUDE_MODE
Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.