|
||||||||||
| 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 ResourceBatchingConfiguration |
batchingConfiguration
|
protected com.atlassian.plugin.webresource.ResourceDependencyResolver |
dependencyResolver
|
protected PluginResourceLocator |
pluginResourceLocator
|
protected static 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)
|
|
WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
ResourceBatchingConfiguration batchingConfiguration)
|
|
WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
ResourceBatchingConfiguration batchingConfiguration,
com.atlassian.plugin.webresource.ResourceDependencyResolver dependencyResolver)
|
|
| Method Summary | |
|---|---|
String |
getRequiredResources()
This is the equivalent of calling getRequiredResources(UrlMode, WebResourceFilter) with
UrlMode.AUTO and a DefaultWebResourceFilter. |
String |
getRequiredResources(UrlMode urlMode)
This is the equivalent of calling getRequiredResources(UrlMode, WebResourceFilter) with the given url
mode and a DefaultWebResourceFilter. |
String |
getRequiredResources(UrlMode urlMode,
WebResourceFilter webResourceFilter)
Returns a String of the resources tags to the previously required resources called via requireResource methods for the specified url mode and resource filter. |
String |
getResourceTags(String moduleCompleteKey)
Returns the resource tags of the specified resource. |
String |
getResourceTags(String moduleCompleteKey,
UrlMode urlMode)
Returns the resource tags of the specified resource. |
String |
getStaticPluginResource(ModuleDescriptor moduleDescriptor,
String resourceName)
A helper method to return a url for 'plugin' resources. |
String |
getStaticPluginResource(ModuleDescriptor moduleDescriptor,
String resourceName,
UrlMode urlMode)
A helper method to return a url for 'plugin' resources. |
String |
getStaticPluginResource(String moduleCompleteKey,
String resourceName)
A helper method to return a url for 'plugin' resources. |
String |
getStaticPluginResource(String moduleCompleteKey,
String resourceName,
UrlMode urlMode)
A helper method to return a url for 'plugin' resources. |
String |
getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
String resourceName)
Deprecated. Use getStaticPluginResource(com.atlassian.plugin.ModuleDescriptor, String) instead |
String |
getStaticResourcePrefix()
A helper method to return a prefix for 'system' static resources. |
String |
getStaticResourcePrefix(String resourceCounter)
A helper method to return a prefix for 'system' static resources. |
String |
getStaticResourcePrefix(String resourceCounter,
UrlMode urlMode)
A helper method to return a prefix for 'system' static resources. |
String |
getStaticResourcePrefix(UrlMode urlMode)
A helper method to return a prefix for 'system' static resources. |
void |
includeResources(Iterable<String> moduleCompleteKeys,
Writer writer,
UrlMode urlMode)
Writes out the resource tags for a specified set of required resources and their dependencies. |
void |
includeResources(Writer writer)
This is the equivalent of of calling includeResources(Writer, UrlMode, WebResourceFilter) with
UrlMode.AUTO and a DefaultWebResourceFilter. |
void |
includeResources(Writer writer,
UrlMode urlMode)
This is the equivalent of of calling includeResources(Writer, UrlMode, WebResourceFilter) with
the given url mode and a DefaultWebResourceFilter. |
void |
includeResources(Writer writer,
UrlMode urlMode,
WebResourceFilter webResourceFilter)
Writes out the resource tags to the previously required resources called via requireResource methods for the specified url mode and resource filter. |
void |
requireResource(String moduleCompleteKey)
Indicates that a given plugin web resource is required. |
void |
requireResource(String moduleCompleteKey,
Writer writer)
Writes the resource tags of the specified resource to the writer. |
void |
requireResource(String moduleCompleteKey,
Writer writer,
UrlMode urlMode)
Writes the resource tags of the specified resource to the writer. |
void |
requireResourcesForContext(String context)
Writes the resource tags of all resources that have the given context specified in their descriptor. |
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 final ResourceBatchingConfiguration batchingConfiguration
protected final com.atlassian.plugin.webresource.ResourceDependencyResolver dependencyResolver
protected static final List<com.atlassian.plugin.webresource.WebResourceFormatter> webResourceFormatters
| Constructor Detail |
|---|
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration)
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
ResourceBatchingConfiguration batchingConfiguration)
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
ResourceBatchingConfiguration batchingConfiguration,
com.atlassian.plugin.webresource.ResourceDependencyResolver dependencyResolver)
| Method Detail |
|---|
public void requireResource(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, UrlMode)public void requireResourcesForContext(String context)
WebResourceManager
requireResourcesForContext in interface WebResourceManagercontext - The name of the context for which you want to require resources (eg "atl.admin")public void includeResources(Writer writer)
includeResources(Writer, UrlMode, WebResourceFilter) with
UrlMode.AUTO and a DefaultWebResourceFilter.
includeResources in interface WebResourceManagerwriter - The writer to write the links toincludeResources(Writer, UrlMode, WebResourceFilter)
public void includeResources(Iterable<String> moduleCompleteKeys,
Writer writer,
UrlMode urlMode)
WebResourceManagerWebResourceManager.requireResource(String).
includeResources in interface WebResourceManagermoduleCompleteKeys - The set of web resource modules to includewriter - the writer to write the links tourlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to
decide
public void includeResources(Writer writer,
UrlMode urlMode)
includeResources(Writer, UrlMode, WebResourceFilter) with
the given url mode and a DefaultWebResourceFilter.
includeResources in interface WebResourceManagerincludeResources(Writer, UrlMode, WebResourceFilter)
public void includeResources(Writer writer,
UrlMode urlMode,
WebResourceFilter webResourceFilter)
includeResources in interface WebResourceManagerwriter - the writer to write the links tourlMode - the url mode to write resource url links inwebResourceFilter - the resource filter to filter resources onpublic String getRequiredResources()
getRequiredResources(UrlMode, WebResourceFilter) with
UrlMode.AUTO and a DefaultWebResourceFilter.
getRequiredResources in interface WebResourceManagergetRequiredResources(UrlMode, WebResourceFilter)public String getRequiredResources(UrlMode urlMode)
getRequiredResources(UrlMode, WebResourceFilter) with the given url
mode and a DefaultWebResourceFilter.
getRequiredResources in interface WebResourceManagergetRequiredResources(UrlMode, WebResourceFilter)
public String getRequiredResources(UrlMode urlMode,
WebResourceFilter webResourceFilter)
getRequiredResources in interface WebResourceManagerurlMode - the url mode to write out the resource tagswebResourceFilter - the web resource filter to filter resources on
WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
public void requireResource(String moduleCompleteKey,
Writer writer)
WebResourceManagerWebResourceManager.getResourceTags(String).
In general, the behavior of this method should be equivalent to calling WebResourceManager.requireResource(String, Writer,
UrlMode) with a urlMode value of UrlMode.AUTO.
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 void requireResource(String moduleCompleteKey,
Writer writer,
UrlMode urlMode)
WebResourceManagerWebResourceManager.getResourceTags(String, UrlMode).
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.
requireResource in interface WebResourceManagermoduleCompleteKey - 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 decidepublic String getResourceTags(String moduleCompleteKey)
WebResourceManagerWriter, use
WebResourceManager.requireResource(String, java.io.Writer).
In general, the behavior of this method should be equivalent to calling WebResourceManager.getResourceTags(String, UrlMode)
with a urlMode value of UrlMode.AUTO.
getResourceTags in interface WebResourceManagermoduleCompleteKey - The fully qualified plugin web resource module (eg jira.webresources:scriptaculous)
WebResourceManager.requireResource(String, Writer)
public String getResourceTags(String moduleCompleteKey,
UrlMode urlMode)
WebResourceManagerWriter, use
WebResourceManager.requireResource(String, java.io.Writer, UrlMode).
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.
getResourceTags in interface WebResourceManagermoduleCompleteKey - 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
WebResourceManager.requireResource(String, Writer, UrlMode)public 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
In general, the behavior of this method should be equivalent to calling WebResourceManager.getStaticResourcePrefix(UrlMode)
with a urlMode value of UrlMode.AUTO.
getStaticResourcePrefix in interface WebResourceManagerpublic String getStaticResourcePrefix(UrlMode urlMode)
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
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.
getStaticResourcePrefix in interface WebResourceManagerurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to
decide
public String getStaticResourcePrefix(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
In general, the behavior of this method should be equivalent to calling WebResourceManager.getStaticResourcePrefix(String,
UrlMode) with a urlMode value of UrlMode.AUTO.
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 String getStaticResourcePrefix(String resourceCounter,
UrlMode urlMode)
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
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.
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 counterurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decide
public String getStaticPluginResource(String moduleCompleteKey,
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) %>
In general, the behavior of this method should be equivalent to calling WebResourceManager.getStaticPluginResource(String,
String, UrlMode) with a urlMode value of UrlMode.AUTO.
getStaticPluginResource in interface WebResourceManagermoduleCompleteKey - complete plugin module keyresourceName - the name of the resource as defined in the plugin manifest
public String getStaticPluginResource(String moduleCompleteKey,
String resourceName,
UrlMode urlMode)
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) %>
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.
getStaticPluginResource in interface WebResourceManagermoduleCompleteKey - complete plugin module keyresourceName - the name of the resource as defined in the plugin manifesturlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decide
public String getStaticPluginResource(ModuleDescriptor moduleDescriptor,
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) %>
In general, the behavior of this method should be equivalent to calling WebResourceManager.getStaticPluginResource(ModuleDescriptor, String, UrlMode) with a urlMode value of UrlMode.AUTO.
getStaticPluginResource in interface WebResourceManagermoduleDescriptor - plugin module descriptor that contains the resourceresourceName - the name of the resource as defined in the plugin manifest
WebResourceManager.getStaticPluginResource(String, String)
public String getStaticPluginResource(ModuleDescriptor moduleDescriptor,
String resourceName,
UrlMode urlMode)
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) %>
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.
getStaticPluginResource in interface WebResourceManagermoduleDescriptor - plugin module descriptor that contains the resourceresourceName - the name of the resource as defined in the plugin manifesturlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decide
WebResourceManager.getStaticPluginResource(String, String, UrlMode)
@Deprecated
public String getStaticPluginResourcePrefix(ModuleDescriptor moduleDescriptor,
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 | |||||||||