|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.plugin.webresource.WebResourceManagerImpl
public class WebResourceManagerImpl
A handy super-class that handles most of the resource management.
To use this manager, you need to have the following UrlRewriteFilter code:<rule> <from>^/s/(.*)/_/(.*)</from> <run class="com.atlassian.plugin.servlet.ResourceDownloadUtils" method="addCachingHeaders" /> <to type="forward">/$2</to> </rule>Sub-classes should implement the abstract methods
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.atlassian.plugin.webresource.WebResourceManager |
|---|
WebResourceManager.IncludeMode |
| Field Summary | |
|---|---|
protected PluginResourceLocator |
pluginResourceLocator
|
protected static java.util.List<com.atlassian.plugin.webresource.WebResourceFormatter> |
webResourceFormatters
|
protected WebResourceIntegration |
webResourceIntegration
|
| Fields inherited from interface com.atlassian.plugin.webresource.WebResourceManager |
|---|
DELAYED_INCLUDE_MODE, INLINE_INCLUDE_MODE |
| Constructor Summary | |
|---|---|
WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getRequiredResources()
|
java.lang.String |
getResourceTags(java.lang.String moduleCompleteKey)
|
java.lang.String |
getStaticPluginResource(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
|
java.lang.String |
getStaticPluginResource(java.lang.String moduleCompleteKey,
java.lang.String resourceName)
A helper method to return a url for 'plugin' resources. |
java.lang.String |
getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
Deprecated. Use getStaticPluginResource(com.atlassian.plugin.ModuleDescriptor, String) instead |
java.lang.String |
getStaticResourcePrefix()
A helper method to return a prefix for 'system' static resources. |
java.lang.String |
getStaticResourcePrefix(java.lang.String resourceCounter)
A helper method to return a prefix for 'system' static resources. |
void |
includeResources(java.io.Writer writer)
Writes out the resource tags to the previously required resources called via WebResourceManager.requireResource(String). |
void |
requireResource(java.lang.String moduleCompleteKey)
Indicates to that a given plugin web resource is required. |
void |
requireResource(java.lang.String moduleCompleteKey,
java.io.Writer writer)
Writes the resource tags of the specified resource to the writer. |
void |
setIncludeMode(WebResourceManager.IncludeMode includeMode)
Deprecated. Since 2.2. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final WebResourceIntegration webResourceIntegration
protected final PluginResourceLocator pluginResourceLocator
protected static final java.util.List<com.atlassian.plugin.webresource.WebResourceFormatter> webResourceFormatters
| Constructor Detail |
|---|
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration)
| Method Detail |
|---|
public void requireResource(java.lang.String moduleCompleteKey)
WebResourceManagerWebResourceManager.includeResources(Writer) is called.
requireResource in interface WebResourceManagermoduleCompleteKey - The fully qualified plugin web resource module (eg jira.webresources:scriptaculous)WebResourceManager.includeResources(Writer)public void includeResources(java.io.Writer writer)
WebResourceManagerWebResourceManager.requireResource(String).
If you need it as a String to embed the tags in a template, use WebResourceManager.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
includeResources in interface WebResourceManagerwriter - The writer to write the links topublic java.lang.String getRequiredResources()
getRequiredResources in interface WebResourceManager#includeResources(Writer)}
public void requireResource(java.lang.String moduleCompleteKey,
java.io.Writer writer)
WebResourceManagerWebResourceManager.getRequiredResources().
requireResource in interface WebResourceManagermoduleCompleteKey - The fully qualified plugin web resource module (eg jira.webresources:scriptaculous)writer - The writer to write the resource tags to.public java.lang.String getResourceTags(java.lang.String moduleCompleteKey)
getResourceTags in interface WebResourceManager#requireResource(String, Writer)}public java.lang.String getStaticResourcePrefix()
WebResourceManager/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
getStaticResourcePrefix in interface WebResourceManagerpublic java.lang.String getStaticResourcePrefix(java.lang.String resourceCounter)
WebResourceManager/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
getStaticResourcePrefix in interface WebResourceManagerresourceCounter - A number that represents the unique version of the resource you require. Every time this
resource changes, you need to increment the resource counter
public java.lang.String getStaticPluginResource(java.lang.String moduleCompleteKey,
java.lang.String resourceName)
WebResourceManager/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) %>
getStaticPluginResource in interface WebResourceManagermoduleCompleteKey - complete plugin module key
public java.lang.String getStaticPluginResource(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
getStaticPluginResource in interface WebResourceManager#getStaticPluginResource(String, String)}
@Deprecated
public java.lang.String getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
getStaticPluginResource(com.atlassian.plugin.ModuleDescriptor, String) instead
getStaticPluginResourcePrefix in interface WebResourceManager@Deprecated public void setIncludeMode(WebResourceManager.IncludeMode includeMode)
WebResourceManager
setIncludeMode in interface WebResourceManagerincludeMode - If there is no decorator for this request, set this to be WebResourceManager.INLINE_INCLUDE_MODEWebResourceManager.DELAYED_INCLUDE_MODE,
WebResourceManager.INLINE_INCLUDE_MODE
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||