Class DefaultConfluenceWebResourceManager

    • 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 interface ConfluenceWebResourceManager
        Specified by:
        includeResources in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        includeResources in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • getRequiredResources

        public String getRequiredResources()
        Specified by:
        getRequiredResources in interface ConfluenceWebResourceManager
        Specified by:
        getRequiredResources in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        getRequiredResources in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • requireResource

        public void requireResource​(String moduleCompleteKey,
                                    Writer writer)
        Specified by:
        requireResource in interface ConfluenceWebResourceManager
        Specified by:
        requireResource in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        requireResource in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • getResourceTags

        public String getResourceTags​(String moduleCompleteKey)
        Specified by:
        getResourceTags in interface ConfluenceWebResourceManager
        Specified by:
        getResourceTags in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        getResourceTags in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • getStaticResourcePrefix

        public String getStaticResourcePrefix()
        Specified by:
        getStaticResourcePrefix in interface ConfluenceWebResourceManager
        Specified by:
        getStaticResourcePrefix in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        getStaticResourcePrefix in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • getStaticResourcePrefix

        public String getStaticResourcePrefix​(String resourceCounter)
        Specified by:
        getStaticResourcePrefix in interface ConfluenceWebResourceManager
        Specified by:
        getStaticResourcePrefix in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        getStaticResourcePrefix in class com.atlassian.plugin.webresource.WebResourceManagerImpl
      • getResources

        public String getResources()
        Description copied from interface: ConfluenceWebResourceManager
        Returns the HTML output of WebResourceManager.includeResources(java.io.Writer, UrlMode), 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 String getCssResources​(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 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
      • requireResource

        public void requireResource​(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
      • 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 interface ConfluenceWebResourceManager
        Parameters:
        spaceKey - the key of the space we're viewing the CSS for, or null for the global CSS.
      • 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 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
      • getEditorCssResources

        public String getEditorCssResources​(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.
      • 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 interface ConfluenceWebResourceManager
        Specified by:
        requireResourcesForContext in interface com.atlassian.plugin.webresource.WebResourceManager
        Overrides:
        requireResourcesForContext in class com.atlassian.plugin.webresource.WebResourceManagerImpl
        Parameters:
        context - The name of the context for which you want to require resources (eg "confluence.main")