Class DefaultConfluenceWebResourceManager
- java.lang.Object
-
- com.atlassian.plugin.webresource.WebResourceManagerImpl
-
- 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
-
-
Constructor Summary
Constructors Constructor Description DefaultConfluenceWebResourceManager(com.atlassian.webresource.api.assembler.WebResourceAssemblerFactory webResourceAssemblerFactory, com.atlassian.plugin.webresource.assembler.LegacyPageBuilderService pageBuilderService, 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, com.atlassian.plugin.PluginAccessor pluginAccessor, ResourceAccessor resourceAccessor, SettingsManager settingsManager, DefaultConfluenceWebResourceService confluenceWebResourceService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAdminCssResources()
String
getCssResources()
Delegates to getCssResources(null)String
getCssResources(String spaceKey)
Returns the HTML output ofWebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
, which includes references to all the delayed CSS resources requested byWebResourceManager.requireResource(String)
.String
getEditorCssResources(String spaceKey)
String
getGlobalCssResourcePrefix()
Get the resource prefix for the global CSS file.String
getJsResources()
Returns the HTML output ofWebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
, which includes references to all the delayed Javascript resources requested byWebResourceManager.requireResource(String)
.Map<String,String>
getMetadata()
Returns the map of key-value pairs added viaConfluenceWebResourceManager.putMetadata(String, String)
.String
getRequiredResources()
String
getResourceContent(String resourceName)
Gets the content of a resource specified.String
getResources()
Returns the HTML output ofWebResourceManager.includeResources(java.io.Writer, UrlMode)
, which includes references to all the delayed Javascript and CSS resources requested byWebResourceManager.requireResource(String)
.String
getResourceTags(String moduleCompleteKey)
String
getSpaceCssPrefix(String spaceKey)
Get the resource prefix for a particular space's CSS file.String
getStaticResourcePrefix()
String
getStaticResourcePrefix(com.atlassian.plugin.webresource.UrlMode urlMode)
String
getStaticResourcePrefix(String resourceCounter)
String
getStaticResourcePrefix(String resourceCounter, com.atlassian.plugin.webresource.UrlMode urlMode)
String
getThemeJsResources(String spaceKey)
Returns the script tags for the theme specific javascript resources.void
includeResources(Writer writer)
void
init()
boolean
putMetadata(String key, String value)
Adds key-value String pairs to a map to be rendered later.void
requireResource(String resourceName)
Wraps the parent method to provide logging.void
requireResource(String moduleCompleteKey, Writer writer)
void
requireResourcesForContext(String context)
Requires all resources which have the given context specified in their descriptor-
Methods inherited from class com.atlassian.plugin.webresource.WebResourceManagerImpl
executeInNewContext, getRequestLocalAssembledResources, getRequestLocalRequiredResources, getRequiredResources, getRequiredResources, getRequiredResources, getResourceTags, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, includeResources, includeResources, includeResources, requireResource
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.plugin.webresource.WebResourceManager
executeInNewContext, getRequiredResources, getRequiredResources, getResourceTags, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, getStaticPluginResource, includeResources, includeResources, includeResources, requireResource
-
-
-
-
Constructor Detail
-
DefaultConfluenceWebResourceManager
public DefaultConfluenceWebResourceManager(com.atlassian.webresource.api.assembler.WebResourceAssemblerFactory webResourceAssemblerFactory, com.atlassian.plugin.webresource.assembler.LegacyPageBuilderService pageBuilderService, 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, com.atlassian.plugin.PluginAccessor pluginAccessor, ResourceAccessor resourceAccessor, SettingsManager settingsManager, DefaultConfluenceWebResourceService confluenceWebResourceService)
- Since:
- 6.7.0
-
-
Method Detail
-
init
@PostConstruct public void init()
-
includeResources
public void includeResources(Writer writer)
- Specified by:
includeResources
in interfaceConfluenceWebResourceManager
- Specified by:
includeResources
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
includeResources
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getRequiredResources
public String getRequiredResources()
- Specified by:
getRequiredResources
in interfaceConfluenceWebResourceManager
- Specified by:
getRequiredResources
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
getRequiredResources
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
requireResource
public void requireResource(String moduleCompleteKey, Writer writer)
- Specified by:
requireResource
in interfaceConfluenceWebResourceManager
- Specified by:
requireResource
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
requireResource
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getResourceTags
public String getResourceTags(String moduleCompleteKey)
- Specified by:
getResourceTags
in interfaceConfluenceWebResourceManager
- Specified by:
getResourceTags
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
getResourceTags
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix()
- Specified by:
getStaticResourcePrefix
in interfaceConfluenceWebResourceManager
- Specified by:
getStaticResourcePrefix
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
getStaticResourcePrefix
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix(com.atlassian.plugin.webresource.UrlMode urlMode)
- Specified by:
getStaticResourcePrefix
in interfaceConfluenceWebResourceManager
-
getStaticResourcePrefix
public String getStaticResourcePrefix(String resourceCounter)
- Specified by:
getStaticResourcePrefix
in interfaceConfluenceWebResourceManager
- Specified by:
getStaticResourcePrefix
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
getStaticResourcePrefix
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix(String resourceCounter, com.atlassian.plugin.webresource.UrlMode urlMode)
- Specified by:
getStaticResourcePrefix
in interfaceConfluenceWebResourceManager
-
getResources
public String getResources()
Description copied from interface:ConfluenceWebResourceManager
Returns the HTML output ofWebResourceManager.includeResources(java.io.Writer, UrlMode)
, which includes references to all the delayed Javascript and CSS resources requested byWebResourceManager.requireResource(String)
.This is a convenience method for velocity templates and is equivalent to calling includeResources with
UrlMode.AUTO
andDefaultWebResourceFilter
.- Specified by:
getResources
in interfaceConfluenceWebResourceManager
-
getCssResources
public String getCssResources()
Description copied from interface:ConfluenceWebResourceManager
Delegates to getCssResources(null)- Specified by:
getCssResources
in interfaceConfluenceWebResourceManager
- See Also:
ConfluenceWebResourceManager.getCssResources(String)
-
getCssResources
public String getCssResources(String spaceKey)
Description copied from interface:ConfluenceWebResourceManager
Returns the HTML output ofWebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
, which includes references to all the delayed CSS resources requested byWebResourceManager.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
andCssWebResource
.- Specified by:
getCssResources
in interfaceConfluenceWebResourceManager
- Parameters:
spaceKey
- spaceKey if null global theme is used.
-
getJsResources
public String getJsResources()
Description copied from interface:ConfluenceWebResourceManager
Returns the HTML output ofWebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter)
, which includes references to all the delayed Javascript resources requested byWebResourceManager.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
andJavascriptWebResource
.- Specified by:
getJsResources
in interfaceConfluenceWebResourceManager
-
getThemeJsResources
public String getThemeJsResources(String spaceKey)
Description copied from interface:ConfluenceWebResourceManager
Returns the script tags for the theme specific javascript resources. If spaceKey isnull
or invalid, the globally configured theme resources are returned.- Specified by:
getThemeJsResources
in interfaceConfluenceWebResourceManager
-
requireResource
public void requireResource(String resourceName)
Wraps the parent method to provide logging.- Specified by:
requireResource
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
requireResource
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getGlobalCssResourcePrefix
public 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 interfaceConfluenceWebResourceManager
-
getSpaceCssPrefix
public String getSpaceCssPrefix(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 interfaceConfluenceWebResourceManager
- Parameters:
spaceKey
- the key of the space we're viewing the CSS for, or null for the global CSS.
-
getResourceContent
public String getResourceContent(String resourceName)
Description copied from interface:ConfluenceWebResourceManager
Gets the content of a resource specified.- Specified by:
getResourceContent
in interfaceConfluenceWebResourceManager
- Parameters:
resourceName
- The fully qualified plugin name and resource to include (egconfluence.web.resources:legacy-styles
)- Returns:
- the content of the resource
-
putMetadata
public boolean putMetadata(String key, String value)
Description copied from interface:ConfluenceWebResourceManager
Adds key-value String pairs to a map to be rendered later.- Specified by:
putMetadata
in interfaceConfluenceWebResourceManager
- Parameters:
key
- a unique key to store the value againstvalue
- an HTML-safe string- Returns:
- true if metadata added to map successfully
-
getMetadata
public Map<String,String> getMetadata()
Description copied from interface:ConfluenceWebResourceManager
Returns the map of key-value pairs added viaConfluenceWebResourceManager.putMetadata(String, String)
. Should report an error if called more than once in a request.- Specified by:
getMetadata
in interfaceConfluenceWebResourceManager
-
getAdminCssResources
public String getAdminCssResources()
- Specified by:
getAdminCssResources
in interfaceConfluenceWebResourceManager
- Returns:
- the CSS for the admin pages. This should not include any custom/dangerous/user configured CSS
-
getEditorCssResources
public String getEditorCssResources(String spaceKey)
- Specified by:
getEditorCssResources
in interfaceConfluenceWebResourceManager
- 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.
-
requireResourcesForContext
public void requireResourcesForContext(String context)
Description copied from interface:ConfluenceWebResourceManager
Requires all resources which have the given context specified in their descriptor- Specified by:
requireResourcesForContext
in interfaceConfluenceWebResourceManager
- Specified by:
requireResourcesForContext
in interfacecom.atlassian.plugin.webresource.WebResourceManager
- Overrides:
requireResourcesForContext
in classcom.atlassian.plugin.webresource.WebResourceManagerImpl
- Parameters:
context
- The name of the context for which you want to require resources (eg "confluence.main")
-
-