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 StringgetAdminCssResources()StringgetCssResources()Delegates to getCssResources(null)StringgetCssResources(String spaceKey)Returns the HTML output ofWebResourceManager.includeResources(Writer, UrlMode, WebResourceFilter), which includes references to all the delayed CSS resources requested byWebResourceManager.requireResource(String).StringgetEditorCssResources(String spaceKey)StringgetGlobalCssResourcePrefix()Get the resource prefix for the global CSS file.StringgetJsResources()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).StringgetRequiredResources()StringgetResourceContent(String resourceName)Gets the content of a resource specified.StringgetResources()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).StringgetResourceTags(String moduleCompleteKey)StringgetSpaceCssPrefix(String spaceKey)Get the resource prefix for a particular space's CSS file.StringgetStaticResourcePrefix()StringgetStaticResourcePrefix(com.atlassian.plugin.webresource.UrlMode urlMode)StringgetStaticResourcePrefix(String resourceCounter)StringgetStaticResourcePrefix(String resourceCounter, com.atlassian.plugin.webresource.UrlMode urlMode)StringgetThemeJsResources(String spaceKey)Returns the script tags for the theme specific javascript resources.voidincludeResources(Writer writer)voidinit()booleanputMetadata(String key, String value)Adds key-value String pairs to a map to be rendered later.voidrequireResource(String resourceName)Wraps the parent method to provide logging.voidrequireResource(String moduleCompleteKey, Writer writer)voidrequireResourcesForContext(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:
includeResourcesin interfaceConfluenceWebResourceManager- Specified by:
includeResourcesin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
includeResourcesin classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getRequiredResources
public String getRequiredResources()
- Specified by:
getRequiredResourcesin interfaceConfluenceWebResourceManager- Specified by:
getRequiredResourcesin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
getRequiredResourcesin classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
requireResource
public void requireResource(String moduleCompleteKey, Writer writer)
- Specified by:
requireResourcein interfaceConfluenceWebResourceManager- Specified by:
requireResourcein interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
requireResourcein classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getResourceTags
public String getResourceTags(String moduleCompleteKey)
- Specified by:
getResourceTagsin interfaceConfluenceWebResourceManager- Specified by:
getResourceTagsin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
getResourceTagsin classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix()
- Specified by:
getStaticResourcePrefixin interfaceConfluenceWebResourceManager- Specified by:
getStaticResourcePrefixin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
getStaticResourcePrefixin classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix(com.atlassian.plugin.webresource.UrlMode urlMode)
- Specified by:
getStaticResourcePrefixin interfaceConfluenceWebResourceManager
-
getStaticResourcePrefix
public String getStaticResourcePrefix(String resourceCounter)
- Specified by:
getStaticResourcePrefixin interfaceConfluenceWebResourceManager- Specified by:
getStaticResourcePrefixin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
getStaticResourcePrefixin classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getStaticResourcePrefix
public String getStaticResourcePrefix(String resourceCounter, com.atlassian.plugin.webresource.UrlMode urlMode)
- Specified by:
getStaticResourcePrefixin interfaceConfluenceWebResourceManager
-
getResources
public String getResources()
Description copied from interface:ConfluenceWebResourceManagerReturns 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.AUTOandDefaultWebResourceFilter.- Specified by:
getResourcesin interfaceConfluenceWebResourceManager
-
getCssResources
public String getCssResources()
Description copied from interface:ConfluenceWebResourceManagerDelegates to getCssResources(null)- Specified by:
getCssResourcesin interfaceConfluenceWebResourceManager- See Also:
ConfluenceWebResourceManager.getCssResources(String)
-
getCssResources
public String getCssResources(String spaceKey)
Description copied from interface:ConfluenceWebResourceManagerReturns 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
nullbeing returned.This is a convenience method for velocity templates and is equivalent to calling includeResources with
UrlMode.AUTOandCssWebResource.- Specified by:
getCssResourcesin interfaceConfluenceWebResourceManager- Parameters:
spaceKey- spaceKey if null global theme is used.
-
getJsResources
public String getJsResources()
Description copied from interface:ConfluenceWebResourceManagerReturns 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
nullbeing returned.This is a convenience method for velocity templates and is equivalent to calling includeResources with
UrlMode.AUTOandJavascriptWebResource.- Specified by:
getJsResourcesin interfaceConfluenceWebResourceManager
-
getThemeJsResources
public String getThemeJsResources(String spaceKey)
Description copied from interface:ConfluenceWebResourceManagerReturns the script tags for the theme specific javascript resources. If spaceKey isnullor invalid, the globally configured theme resources are returned.- Specified by:
getThemeJsResourcesin interfaceConfluenceWebResourceManager
-
requireResource
public void requireResource(String resourceName)
Wraps the parent method to provide logging.- Specified by:
requireResourcein interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
requireResourcein classcom.atlassian.plugin.webresource.WebResourceManagerImpl
-
getGlobalCssResourcePrefix
public String getGlobalCssResourcePrefix()
Description copied from interface:ConfluenceWebResourceManagerGet 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:
getGlobalCssResourcePrefixin interfaceConfluenceWebResourceManager
-
getSpaceCssPrefix
public String getSpaceCssPrefix(String spaceKey)
Description copied from interface:ConfluenceWebResourceManagerGet 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:
getSpaceCssPrefixin 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:ConfluenceWebResourceManagerGets the content of a resource specified.- Specified by:
getResourceContentin 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:ConfluenceWebResourceManagerAdds key-value String pairs to a map to be rendered later.- Specified by:
putMetadatain 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:ConfluenceWebResourceManagerReturns 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:
getMetadatain interfaceConfluenceWebResourceManager
-
getAdminCssResources
public String getAdminCssResources()
- Specified by:
getAdminCssResourcesin 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:
getEditorCssResourcesin 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:ConfluenceWebResourceManagerRequires all resources which have the given context specified in their descriptor- Specified by:
requireResourcesForContextin interfaceConfluenceWebResourceManager- Specified by:
requireResourcesForContextin interfacecom.atlassian.plugin.webresource.WebResourceManager- Overrides:
requireResourcesForContextin classcom.atlassian.plugin.webresource.WebResourceManagerImpl- Parameters:
context- The name of the context for which you want to require resources (eg "confluence.main")
-
-