Class WebResourceManagerImpl
- All Implemented Interfaces:
WebResourceManager
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWebResourceManagerImpl(Globals globals, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider) WebResourceManagerImpl(Globals globals, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration) WebResourceManagerImpl(WebResourceAssemblerFactory webResourceAssemblerFactory, LegacyPageBuilderService pageBuilderService, PluginResourceLocator pluginResourceLocator, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration) WebResourceManagerImpl(WebResourceAssemblerFactory webResourceAssemblerFactory, PluginResourceLocator pluginResourceLocator, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected AssembledResourcesprotected RequiredResourcesgetRequiredResources(UrlMode urlMode) This is the equivalent of callinggetRequiredResources(UrlMode, WebResourceFilter)with the given url mode and aDefaultWebResourceFilter.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 StringgetRequiredResources(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.getResourceTags(String moduleCompleteKey, UrlMode urlMode) voidincludeResources(Writer writer, UrlMode urlMode) This is the equivalent of of callingincludeResources(Writer, UrlMode, WebResourceFilter)with the given url mode and aDefaultWebResourceFilter.voidincludeResources(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.voidincludeResources(Iterable<String> moduleCompleteKeys, Writer writer, UrlMode urlMode) voidrequireResource(String moduleCompleteKey) voidrequireResource(String moduleCompleteKey, Writer writer, UrlMode urlMode) voidrequireResourcesForContext(String context)
-
Field Details
-
pageBuilderService
-
-
Constructor Details
-
WebResourceManagerImpl
public WebResourceManagerImpl(Globals globals, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider) -
WebResourceManagerImpl
public WebResourceManagerImpl(Globals globals, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration) -
WebResourceManagerImpl
public WebResourceManagerImpl(WebResourceAssemblerFactory webResourceAssemblerFactory, PluginResourceLocator pluginResourceLocator, WebResourceIntegration webResourceIntegration, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration) -
WebResourceManagerImpl
public WebResourceManagerImpl(WebResourceAssemblerFactory webResourceAssemblerFactory, LegacyPageBuilderService pageBuilderService, PluginResourceLocator pluginResourceLocator, WebResourceUrlProvider webResourceUrlProvider, ResourceBatchingConfiguration batchingConfiguration)
-
-
Method Details
-
requireResource
- Specified by:
requireResourcein interfaceWebResourceManager
-
requireResourcesForContext
- Specified by:
requireResourcesForContextin interfaceWebResourceManager
-
includeResources
- Specified by:
includeResourcesin interfaceWebResourceManager
-
includeResources
This is the equivalent of of callingincludeResources(Writer, UrlMode, WebResourceFilter)with the given url mode and aDefaultWebResourceFilter.- Specified by:
includeResourcesin interfaceWebResourceManager- See Also:
-
includeResources
Writes out the resource tags to the previously required resources called via requireResource methods for the specified url mode and resource filter. Note that this method will clear the list of previously required resources.- Specified by:
includeResourcesin interfaceWebResourceManager- Parameters:
writer- the writer to write the links tourlMode- the url mode to write resource url links inwebResourceFilter- the resource filter to filter resources on- Since:
- 2.4
-
getRequiredResources
This is the equivalent of callinggetRequiredResources(UrlMode, WebResourceFilter)with the given url mode and aDefaultWebResourceFilter.- Specified by:
getRequiredResourcesin interfaceWebResourceManager- See Also:
-
getRequiredResources
Returns a String of the resources tags to the previously required resources called via requireResource methods for the specified url mode and resource filter. Note that this method will NOT clear the list of previously required resources.- Specified by:
getRequiredResourcesin interfaceWebResourceManager- Parameters:
urlMode- the url mode to write out the resource tagsfilter- the web resource filter to filter resources on- Returns:
- a String of the resource tags
- Since:
- 2.4
-
getRequiredResources
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.You should note that the WebResourceManager cannot break context batch resources down beyond the granularity of the context so excluding particular resource keys does not necessary exclude them from a context batch. To safely use this method it is expected that after the initial page load any subsequent "dynamic" requests for resources should be at the granularity of individual resources and not contexts. However you can request contexts if you are confident that there hasn't been an overlap of contexts and dynamically requested macros. A typical safe example is in Confluence when rendering macros the macro rendering process will have requested individual resources which will not exist in any contexts.
This method is available for use by sub-classes but is not part of the public interface since it does not form a complete solution for dynamic resource handling.
- Parameters:
urlMode- the url mode to write out the resource tagswebResourceFilter- 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- Returns:
- a String of the resource tags
- Since:
- 2.12.5
-
requireResource
- Specified by:
requireResourcein interfaceWebResourceManager
-
getResourceTags
- Specified by:
getResourceTagsin interfaceWebResourceManager
-
getRequestLocalAssembledResources
-
getRequestLocalRequiredResources
-