|
||||||||||
| 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,
WebResourceUrlProvider webResourceUrlProvider)
|
|
WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
WebResourceUrlProvider webResourceUrlProvider,
ResourceBatchingConfiguration batchingConfiguration)
|
|
WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
WebResourceUrlProvider webResourceUrlProvider,
ResourceBatchingConfiguration batchingConfiguration,
com.atlassian.plugin.webresource.ResourceDependencyResolver dependencyResolver)
|
|
| Method Summary | ||
|---|---|---|
|
executeInNewContext(com.google.common.base.Supplier<T> nestedExecution)
Executes a Supplier within a new WebResourceManager context. |
|
String |
getRequiredResources()
Deprecated. |
|
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 filter)
Returns a String of the resources tags to the previously required resources called via requireResource methods for the specified url mode and resource filter. |
|
protected String |
getRequiredResources(UrlMode urlMode,
WebResourceFilter webResourceFilter,
Set<String> excludedResourceKeys,
List<String> excludedContexts)
Get the resources that have been required but excluding certain resource keys and certain contexts. |
|
String |
getResourceTags(String moduleCompleteKey)
Deprecated. |
|
String |
getResourceTags(String moduleCompleteKey,
UrlMode urlMode)
Returns the resource tags of the specified resource. |
|
protected String |
getResourceTagsForAdditionalContexts(List<String> contexts)
Create the HTML tags necessary for requesting the supplied contexts in addition to any contexts already requested of the WebResourceManager (using requireResourcesForContext(String)). |
|
protected String |
getResourceTagsForAdditionalContexts(List<String> contexts,
UrlMode urlMode,
WebResourceFilter filter)
|
|
String |
getStaticPluginResource(ModuleDescriptor<?> moduleDescriptor,
String resourceName)
Deprecated. |
|
String |
getStaticPluginResource(ModuleDescriptor<?> moduleDescriptor,
String resourceName,
UrlMode urlMode)
A helper method to return a url for 'plugin' resources. |
|
String |
getStaticPluginResource(String moduleCompleteKey,
String resourceName)
Deprecated. |
|
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. |
|
String |
getStaticResourcePrefix()
Deprecated. |
|
String |
getStaticResourcePrefix(String resourceCounter)
Deprecated. |
|
String |
getStaticResourcePrefix(String resourceCounter,
UrlMode urlMode)
A helper method to return a prefix for 'system' static resources. |
|
String |
getStaticResourcePrefix(UrlMode urlMode)
Deprecated. |
|
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)
Deprecated. |
|
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)
Deprecated. |
|
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. |
|
| 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,
WebResourceUrlProvider webResourceUrlProvider)
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
WebResourceUrlProvider webResourceUrlProvider,
ResourceBatchingConfiguration batchingConfiguration)
public WebResourceManagerImpl(PluginResourceLocator pluginResourceLocator,
WebResourceIntegration webResourceIntegration,
WebResourceUrlProvider webResourceUrlProvider,
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(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(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 filter)
getRequiredResources in interface WebResourceManagerurlMode - the url mode to write out the resource tagsfilter - the web resource filter to filter resources on
WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
protected String getRequiredResources(UrlMode urlMode,
WebResourceFilter webResourceFilter,
Set<String> excludedResourceKeys,
List<String> excludedContexts)
urlMode - the url mode to write out the resource tagsfilter - the web resource filter to filter resources onexcludedResourceKeys - the complete key of resources to be excluded. These exclusion will not apply to any requested contexts
so if a context happens to include these resource keys it will still be served (unless excluded as a context).excludedContexts - contexts to be excluded when the tags are written
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 decide
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)protected String getResourceTagsForAdditionalContexts(List<String> contexts)
requireResourcesForContext(String)).
This is intended to be useful in the case of storing in a page render the requests that will need to
be made if you want to dynamically add additional contexts after the initial render. This doesn't form
a complete solution to dynamically adding resources to a page which is the reason this method is not
part of the public API.
contexts - the additional contexts to create tags for
protected String getResourceTagsForAdditionalContexts(List<String> contexts,
UrlMode urlMode,
WebResourceFilter filter)
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,
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,
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)public <T> T executeInNewContext(com.google.common.base.Supplier<T> nestedExecution)
WebResourceManager
executeInNewContext in interface WebResourceManagernestedExecution - the code to be executed in the empty context.
@Deprecated public String getRequiredResources()
getRequiredResources in interface WebResourceManager@Deprecated public String getResourceTags(String moduleCompleteKey)
getResourceTags in interface WebResourceManager
@Deprecated
public String getStaticPluginResource(ModuleDescriptor<?> moduleDescriptor,
String resourceName)
getStaticPluginResource in interface WebResourceManager
@Deprecated
public String getStaticPluginResource(String moduleCompleteKey,
String resourceName)
getStaticPluginResource in interface WebResourceManager
@Deprecated
public String getStaticPluginResourcePrefix(ModuleDescriptor<?> moduleDescriptor,
String resourceName)
getStaticPluginResourcePrefix in interface WebResourceManager@Deprecated public String getStaticResourcePrefix()
getStaticResourcePrefix in interface WebResourceManager@Deprecated public 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
@Deprecated public String getStaticResourcePrefix(String resourceCounter)
getStaticResourcePrefix in interface WebResourceManager@Deprecated public void includeResources(Writer writer)
includeResources in interface WebResourceManager
@Deprecated
public void requireResource(String moduleCompleteKey,
Writer writer)
requireResource in interface WebResourceManager@Deprecated public void setIncludeMode(WebResourceManager.IncludeMode includeMode)
setIncludeMode in interface WebResourceManagerWebResourceManager.INLINE_INCLUDE_MODE
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||