|
||||||||||
| 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 |
|---|
| Fields inherited from interface com.atlassian.plugin.webresource.WebResourceManager |
|---|
DELAYED_INCLUDE_MODE, INLINE_INCLUDE_MODE |
| Constructor Summary | |
|---|---|
WebResourceManagerImpl(WebResourceIntegration webResourceIntegration)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getStaticPluginResource(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
A helper method to return a url for 'plugin' resources. |
java.lang.String |
getStaticPluginResource(java.lang.String pluginModuleKey,
java.lang.String resourceName)
|
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)
Include the resources that have already been specified by the request in the page. |
void |
requireResource(java.lang.String resourceName)
Called by a component to indicate that a certain resource is required to be inserted into this page. |
void |
requireResource(java.lang.String resourceName,
java.io.Writer writer)
Called by a component to indicate that a certain resource is required to be inserted into this page. |
void |
setIncludeMode(WebResourceManager.IncludeMode includeMode)
Whether resources should be included inline, or at the top of the page. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebResourceManagerImpl(WebResourceIntegration webResourceIntegration)
| Method Detail |
|---|
public void requireResource(java.lang.String resourceName)
WebResourceManagerWebResourceManager.DELAYED_INCLUDE_MODE.
Use this if you do not want to inline a resource.
requireResource in interface WebResourceManagerresourceName - The fully qualified plugin name to include (eg jira.webresources:scriptaculous)
public void requireResource(java.lang.String resourceName,
java.io.Writer writer)
WebResourceManager
requireResource in interface WebResourceManagerresourceName - The fully qualified plugin name to include (eg jira.webresources:scriptaculous)writer - The writer to write the links to if the WebResourceManager.IncludeMode equals WebResourceManager.INLINE_INCLUDE_MODEpublic void includeResources(java.io.Writer writer)
WebResourceManager
<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 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 getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
java.lang.String resourceName)
getStaticPluginResource(com.atlassian.plugin.ModuleDescriptor, String) instead
getStaticPluginResourcePrefix in interface WebResourceManager
public java.lang.String getStaticPluginResource(ModuleDescriptor moduleDescriptor,
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 WebResourceManager
public java.lang.String getStaticPluginResource(java.lang.String pluginModuleKey,
java.lang.String resourceName)
getStaticPluginResource in interface WebResourceManagerpluginModuleKey - complete plugin module key
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 | |||||||||