com.atlassian.confluence.plugin.webresource
Class DefaultConfluenceWebResourceManager

java.lang.Object
  extended by com.atlassian.plugin.webresource.WebResourceManagerImpl
      extended by com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager
All Implemented Interfaces:
ConfluenceWebResourceManager, com.atlassian.plugin.webresource.WebResourceManager

public class DefaultConfluenceWebResourceManager
extends com.atlassian.plugin.webresource.WebResourceManagerImpl
implements ConfluenceWebResourceManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.plugin.webresource.WebResourceManager
com.atlassian.plugin.webresource.WebResourceManager.IncludeMode
 
Field Summary
 
Fields inherited from class com.atlassian.plugin.webresource.WebResourceManagerImpl
batchingConfiguration, dependencyResolver, pageBuilderService, pluginResourceLocator, webResourceIntegration, webResourceUrlProvider
 
Fields inherited from interface com.atlassian.plugin.webresource.WebResourceManager
DELAYED_INCLUDE_MODE, INLINE_INCLUDE_MODE
 
Constructor Summary
DefaultConfluenceWebResourceManager(com.atlassian.webresource.api.assembler.WebResourceAssemblerFactory webResourceAssemblerFactory, com.atlassian.plugin.webresource.PluginResourceLocator pluginResourceLocator, com.atlassian.plugin.webresource.WebResourceIntegration webResourceIntegration, com.atlassian.plugin.webresource.WebResourceUrlProvider webResourceUrlProvider, com.atlassian.plugin.webresource.ResourceBatchingConfiguration batchingConfiguration, com.atlassian.plugin.webresource.ResourceDependencyResolver resourceDependencyResolver, ThemeManager themeManager, StylesheetManager stylesheetManager, CssResourceCounterManager cssResourceCounterManager, com.atlassian.plugin.PluginAccessor pluginAccessor, ResourceAccessor resourceAccessor, SettingsManager settingsManager)
           
 
Method Summary
 java.lang.String getAdminCssResources()
           
 java.lang.String getCssResources()
          Delegates to getCssResources(null)
 java.lang.String getCssResources(java.lang.String spaceKey)
          Returns the HTML output of WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter), which includes references to all the delayed CSS resources requested by WebResourceManager.requireResource(String).
 java.lang.String getEditorCssResources(java.lang.String spaceKey)
           
 java.lang.String getGlobalCssResourcePrefix()
          Get the resource prefix for the global CSS file.
 java.lang.String getJsResources()
          Returns the HTML output of WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter), which includes references to all the delayed Javascript resources requested by WebResourceManager.requireResource(String).
 java.util.Map<java.lang.String,java.lang.String> getMetadata()
          Returns the map of key-value pairs added via ConfluenceWebResourceManager.putMetadata(String, String).
 java.lang.String getResourceContent(java.lang.String resourceName)
          Gets the content of a resource specified.
 java.lang.String getResources()
          Returns the HTML output of WebResourceManager.includeResources(java.io.Writer), which includes references to all the delayed Javascript and CSS resources requested by WebResourceManager.requireResource(String).
 java.lang.String getResourceTags(java.lang.String resourceName)
           
 java.lang.String getResourceTagsForAdditionalContextsHtml(java.util.List<java.lang.String> contexts)
          Create the HTML tags necessary for requesting the supplied contexts in addition to any contexts already requested of the WebResourceManager (using WebResourceManagerImpl.requireResourcesForContext(String)).
 java.lang.String getSpaceCssPrefix(java.lang.String spaceKey)
          Get the resource prefix for a particular space's CSS file.
 java.lang.String getThemeJsResources(java.lang.String spaceKey)
          Returns the script tags for the theme specific javascript resources.
 boolean putMetadata(java.lang.String key, java.lang.String value)
          Adds key-value String pairs to a map to be rendered later.
 void requireResource(java.lang.String resourceName)
          Wraps the parent method to provide logging.
 
Methods inherited from class com.atlassian.plugin.webresource.WebResourceManagerImpl
executeInNewContext, getRequestLocalAssembledResources, getRequestLocalRequiredResources, getRequiredResources, getRequiredResources, getRequiredResources, getRequiredResources, getResourceTags, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, includeResources, includeResources, includeResources, includeResources, requireResource, requireResource, requireResourcesForContext, setIncludeMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.plugin.webresource.ConfluenceWebResourceManager
requireResourcesForContext
 
Methods inherited from interface com.atlassian.plugin.webresource.WebResourceManager
executeInNewContext, getRequiredResources, getRequiredResources, getRequiredResources, getResourceTags, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, getStaticResourcePrefix, includeResources, includeResources, includeResources, includeResources, requireResource, requireResource, setIncludeMode
 

Constructor Detail

DefaultConfluenceWebResourceManager

public DefaultConfluenceWebResourceManager(com.atlassian.webresource.api.assembler.WebResourceAssemblerFactory webResourceAssemblerFactory,
                                           com.atlassian.plugin.webresource.PluginResourceLocator pluginResourceLocator,
                                           com.atlassian.plugin.webresource.WebResourceIntegration webResourceIntegration,
                                           com.atlassian.plugin.webresource.WebResourceUrlProvider webResourceUrlProvider,
                                           com.atlassian.plugin.webresource.ResourceBatchingConfiguration batchingConfiguration,
                                           com.atlassian.plugin.webresource.ResourceDependencyResolver resourceDependencyResolver,
                                           ThemeManager themeManager,
                                           StylesheetManager stylesheetManager,
                                           CssResourceCounterManager cssResourceCounterManager,
                                           com.atlassian.plugin.PluginAccessor pluginAccessor,
                                           ResourceAccessor resourceAccessor,
                                           SettingsManager settingsManager)
Method Detail

getResources

public java.lang.String getResources()
Description copied from interface: ConfluenceWebResourceManager
Returns the HTML output of WebResourceManager.includeResources(java.io.Writer), which includes references to all the delayed Javascript and CSS resources requested by WebResourceManager.requireResource(String). This is a convenience method for velocity templates and is equivalent to calling includeResources with UrlMode.AUTO and DefaultWebResourceFilter.

Specified by:
getResources in interface ConfluenceWebResourceManager

getCssResources

public java.lang.String getCssResources()
Description copied from interface: ConfluenceWebResourceManager
Delegates to getCssResources(null)

Specified by:
getCssResources in interface ConfluenceWebResourceManager
See Also:
ConfluenceWebResourceManager.getCssResources(String)

getCssResources

public java.lang.String getCssResources(java.lang.String spaceKey)
Description copied from interface: ConfluenceWebResourceManager
Returns the HTML output of WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter), which includes references to all the delayed CSS resources requested by WebResourceManager.requireResource(String). This method should only be called once for each request. Multiple calls to this method will result with null being returned. This is a convenience method for velocity templates and is equivalent to calling includeResources with UrlMode.AUTO and CssWebResource.

Specified by:
getCssResources in interface ConfluenceWebResourceManager
Parameters:
spaceKey - spaceKey if null global theme is used.

getJsResources

public java.lang.String getJsResources()
Description copied from interface: ConfluenceWebResourceManager
Returns the HTML output of WebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter), which includes references to all the delayed Javascript resources requested by WebResourceManager.requireResource(String). This method should only be called once for each request. Multiple calls to this method will result with null being returned. This is a convenience method for velocity templates and is equivalent to calling includeResources with UrlMode.AUTO and JavascriptWebResource.

Specified by:
getJsResources in interface ConfluenceWebResourceManager

getThemeJsResources

public java.lang.String getThemeJsResources(java.lang.String spaceKey)
Description copied from interface: ConfluenceWebResourceManager
Returns the script tags for the theme specific javascript resources. If spaceKey is null or invalid, the globally configured theme resources are returned.

Specified by:
getThemeJsResources in interface ConfluenceWebResourceManager

getResourceTags

public java.lang.String getResourceTags(java.lang.String resourceName)
Specified by:
getResourceTags in interface com.atlassian.plugin.webresource.WebResourceManager
Overrides:
getResourceTags in class com.atlassian.plugin.webresource.WebResourceManagerImpl

requireResource

public void requireResource(java.lang.String resourceName)
Wraps the parent method to provide logging.

Specified by:
requireResource in interface com.atlassian.plugin.webresource.WebResourceManager
Overrides:
requireResource in class com.atlassian.plugin.webresource.WebResourceManagerImpl

getGlobalCssResourcePrefix

public java.lang.String getGlobalCssResourcePrefix()
Description copied from interface: ConfluenceWebResourceManager
Get the resource prefix for the global CSS file. This prefix should be updated every time there is a change to the global theme or colour scheme.

Specified by:
getGlobalCssResourcePrefix in interface ConfluenceWebResourceManager

getSpaceCssPrefix

public java.lang.String getSpaceCssPrefix(java.lang.String spaceKey)
Description copied from interface: ConfluenceWebResourceManager
Get the resource prefix for a particular space's CSS file. This prefix should be updated every time there is a change to the space's theme or colour scheme.

Specified by:
getSpaceCssPrefix in interface ConfluenceWebResourceManager
Parameters:
spaceKey - the key of the space we're viewing the CSS for, or null for the global CSS.

getResourceContent

public java.lang.String getResourceContent(java.lang.String resourceName)
Description copied from interface: ConfluenceWebResourceManager
Gets the content of a resource specified.

Specified by:
getResourceContent in interface ConfluenceWebResourceManager
Parameters:
resourceName - The fully qualified plugin name and resource to include (eg confluence.web.resources:legacy-styles)
Returns:
the content of the resource

putMetadata

public boolean putMetadata(java.lang.String key,
                           java.lang.String value)
Description copied from interface: ConfluenceWebResourceManager
Adds key-value String pairs to a map to be rendered later.

Specified by:
putMetadata in interface ConfluenceWebResourceManager
Parameters:
key - a unique key to store the value against
value - an HTML-safe string
Returns:
true if metadata added to map successfully

getMetadata

public java.util.Map<java.lang.String,java.lang.String> getMetadata()
Description copied from interface: ConfluenceWebResourceManager
Returns the map of key-value pairs added via ConfluenceWebResourceManager.putMetadata(String, String). Should report an error if called more than once in a request.

Specified by:
getMetadata in interface ConfluenceWebResourceManager

getAdminCssResources

public java.lang.String getAdminCssResources()
Specified by:
getAdminCssResources in interface ConfluenceWebResourceManager
Returns:
the CSS for the admin pages. This should not include any custom/dangerous/user configured CSS

getEditorCssResources

public java.lang.String getEditorCssResources(java.lang.String spaceKey)
Specified by:
getEditorCssResources in interface ConfluenceWebResourceManager
Parameters:
spaceKey - space key to allow custom styling. Can be null to use global configured theme.
Returns:
link tags for all the CSS used by the editor iframe.

getResourceTagsForAdditionalContextsHtml

public java.lang.String getResourceTagsForAdditionalContextsHtml(java.util.List<java.lang.String> contexts)
Create the HTML tags necessary for requesting the supplied contexts in addition to any contexts already requested of the WebResourceManager (using WebResourceManagerImpl.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.

Specified by:
getResourceTagsForAdditionalContextsHtml in interface ConfluenceWebResourceManager
Parameters:
contexts - the additional contexts to create tags for
Returns:
the HTML tags required to request the additional context resources


Copyright © 2003-2014 Atlassian. All Rights Reserved.