Class Config
java.lang.Object
com.atlassian.plugin.webresource.impl.config.Config
Unites all the configurations in one place. Not exposed as API, so it is possible to change it and store settings
that should not be exposed publicly.
- Since:
- 3.3
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionConfig(ResourceBatchingConfiguration batchingConfiguration, WebResourceIntegration integration, WebResourceUrlProvider urlProvider, com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory, TransformerCache transformerCache) -
Method Summary
Modifier and TypeMethodDescriptionprotected ResourcebuildResource(Bundle bundle, com.atlassian.plugin.elements.ResourceLocation resourceLocation) Helper to hide bunch of integration code and simplify resource creation.Represents product state considering everything that contributes to content of resources.getBaseUrl(boolean isAbsolute) Deprecated.protected booleanWill do its best to return a result from DarkFeatureManager, but will fallback to System propertiesReturns a URL transformer to allow clients to map resource URLs as ingetResourceCdnPrefix(String).getContentAnnotator(String type) intgetContentType(String path) static DependencyGraph<Requestable>intDeprecated.since 3.3.2getModuleResource(String completeKey, String name) Get not declared Resource.getPluginResource(String pluginKey, String name) Get Resource for Plugin.static StringgetPluginVersionOrInstallTime(com.atlassian.plugin.Plugin plugin, boolean usePluginInstallTimeInsteadOfTheVersionForSnapshotPlugins) For SNAPSHOT plugins will return install time instead of the version.protected static List<com.atlassian.plugin.elements.ResourceLocation>getResourceLocations(WebResourceModuleDescriptor webResourceModuleDescriptor, boolean compiledResourcesEnabled) getResourcesWithoutCache(Bundle bundle) Queries the plugin system and return list of Resources for Web Resource.getResourceUrlPrefix(String hash, String bundleHash, boolean isAbsolute) Deprecated.since 3.3.2intLinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getWebResourceData(String key) Get data resources for web resource.Analyzes current state of the plugin system and return web resources.booleanstatic booleanDetermines if bundle hash validation for batch resources should be disabled.booleanbooleanbooleanstatic booleanisContextKey(String key) If the key is context or web resource key.booleanDeprecated.since 5.0.0, use ResourcePriority.DEFER insteadbooleanIf incremental cache enabled.booleanbooleanIf minification enabled.booleanbooleanbooleanisSourceMapEnabledFor(String typeOrContentType) static booleanDetermines if batch URLs contexts' are sorted to ensure that the same URL is generated no matter what order the contexts are required in.booleanbooleanbooleanbooleanbooleanbooleanbooleanintHash code representing the state of config.voidsetContentTypeResolver(com.atlassian.plugin.servlet.ContentTypeResolver contentTypeResolver) Needed because `contentTypeResolver` isn't available at the time Config is created and set up a bit later.voidsetStaticTransformers(StaticTransformers staticTransformers) static StringvirtualContextKeyToWebResourceKey(String virtualContextKey) Convert virtual context key to web resource key.
-
Field Details
-
SOURCE_PARAM_NAME
- See Also:
-
BATCH_PARAM_NAME
- See Also:
-
MEDIA_PARAM_NAME
- See Also:
-
CONTENT_TYPE_PARAM_NAME
- See Also:
-
CACHE_PARAM_NAME
- See Also:
-
ALLOW_PUBLIC_USE_PARAM_NAME
- See Also:
-
ASYNC_SCRIPT_PARAM_NAME
- See Also:
-
DEFER_SCRIPT_PARAM_NAME
- See Also:
-
INITIAL_RENDERED_SCRIPT_PARAM_NAME
- See Also:
-
WRM_KEY_PARAM_NAME
- See Also:
-
WRM_BATCH_TYPE_PARAM_NAME
- See Also:
-
DOWNLOAD_PARAM_VALUE
- See Also:
-
JS_TYPE
- See Also:
-
JS_CONTENT_TYPE
- See Also:
-
CSS_TYPE
- See Also:
-
CSS_CONTENT_TYPE
- See Also:
-
LESS_TYPE
- See Also:
-
SOY_TYPE
- See Also:
-
CSS_EXTENSION
- See Also:
-
LESS_EXTENSION
- See Also:
-
JS_EXTENSION
- See Also:
-
SOY_EXTENSION
- See Also:
-
BATCH_TYPES
-
GET_URL_MAX_LENGTH
public static final int GET_URL_MAX_LENGTH- See Also:
-
HTTP_PARAM_NAMES
-
PARAMS_SORT_ORDER
-
CONTEXT_PREFIX
- See Also:
-
SUPER_BATCH_CONTEXT_KEY
- See Also:
-
SUPERBATCH_KEY
- See Also:
-
SYNCBATCH_CONTEXT_KEY
- See Also:
-
SYNCBATCH_KEY
- See Also:
-
INCREMENTAL_CACHE_SIZE
- See Also:
-
ENABLE_BUNDLE_HASH_VALIDATION
- See Also:
-
DISABLE_PERFORMANCE_TRACKING
- See Also:
-
-
Constructor Details
-
Config
public Config(ResourceBatchingConfiguration batchingConfiguration, WebResourceIntegration integration, WebResourceUrlProvider urlProvider, com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory, TransformerCache transformerCache)
-
-
Method Details
-
isContextKey
If the key is context or web resource key. -
virtualContextKeyToWebResourceKey
Convert virtual context key to web resource key. -
getResourceLocations
protected static List<com.atlassian.plugin.elements.ResourceLocation> getResourceLocations(WebResourceModuleDescriptor webResourceModuleDescriptor, boolean compiledResourcesEnabled) -
isStaticContextOrderEnabled
public static boolean isStaticContextOrderEnabled()Determines if batch URLs contexts' are sorted to ensure that the same URL is generated no matter what order the contexts are required in.- Since:
- 3.6.0
-
getPluginVersionOrInstallTime
public static String getPluginVersionOrInstallTime(com.atlassian.plugin.Plugin plugin, boolean usePluginInstallTimeInsteadOfTheVersionForSnapshotPlugins) For SNAPSHOT plugins will return install time instead of the version. Needed to simplify working with SNAPSHOT plugins and flushing cache when new SNAPSHOT plugin installed with same version but different content. -
setContentTypeResolver
public void setContentTypeResolver(com.atlassian.plugin.servlet.ContentTypeResolver contentTypeResolver) Needed because `contentTypeResolver` isn't available at the time Config is created and set up a bit later. -
isContentCacheEnabled
public boolean isContentCacheEnabled()- Returns:
- if cache should be enabled.
-
getContentCacheSize
public int getContentCacheSize()- Returns:
- amount of files to be stored in cache.
-
getIncrementalCacheSize
public int getIncrementalCacheSize()- Returns:
- amount of files to be stored in cache.
-
getCacheDirectory
- Returns:
- directory where cache content would be stored as files.
-
getDependencyGraph
-
isSourceMapEnabledFor
- Parameters:
typeOrContentType- type or content type.- Returns:
- if source map enabled for this type or content type.
-
isSourceMapEnabled
public boolean isSourceMapEnabled()- Returns:
- if source map enabled.
-
isCdnEnabled
public boolean isCdnEnabled()- Returns:
- if CDN is globally enabled.
-
getBaseUrl
- Returns:
- base url, where web resources is mounted to.
-
getBaseUrl
- Parameters:
isAbsolute- if url should be absolute or relative.- Returns:
- base url, where web resources is mounted to.
-
getResourceUrlPrefix
- Returns:
- url prefix for resource, including base url.
-
getResourceCdnPrefix
- Returns:
- url prefixed with CDN prefix.
-
getContentType
- Returns:
- content type for given path.
-
getContentAnnotator
- Returns:
- content annotators for given type.
-
getStaticTransformers
- Returns:
- static transformers.
-
setStaticTransformers
-
isSyncContextCreated
public boolean isSyncContextCreated()- Returns:
- true if sync context has been created (is not empty)
- Throws:
RuntimeException- if called beforegetWebResourcesWithoutCache().- Since:
- 3.5.27
-
isSuperbatchCreated
public boolean isSuperbatchCreated()- Returns:
- true if superbatch context has been created (is not empty)
- Throws:
RuntimeException- if called beforegetWebResourcesWithoutCache().- Since:
- 5.5.0
-
getWebResourcesWithoutCache
Analyzes current state of the plugin system and return web resources. -
getResourcesWithoutCache
Queries the plugin system and return list of Resources for Web Resource. -
getWebResourceData
Get data resources for web resource. -
isMinificationEnabled
public boolean isMinificationEnabled()If minification enabled. -
buildResource
protected Resource buildResource(Bundle bundle, com.atlassian.plugin.elements.ResourceLocation resourceLocation) Helper to hide bunch of integration code and simplify resource creation. -
getModuleResource
Get not declared Resource. -
getPluginResource
Get Resource for Plugin. -
optimiseSourceMapsForDevelopment
public boolean optimiseSourceMapsForDevelopment() -
isSyncBatchingEnabled
public boolean isSyncBatchingEnabled() -
isSuperBatchingEnabled
public boolean isSuperBatchingEnabled() -
isBatchContentTrackingEnabled
public boolean isBatchContentTrackingEnabled() -
isContextBatchingEnabled
public boolean isContextBatchingEnabled() -
isWebResourceBatchingEnabled
public boolean isWebResourceBatchingEnabled() -
isIncrementalCacheEnabled
public boolean isIncrementalCacheEnabled()If incremental cache enabled. -
partialHashCode
public int partialHashCode()Hash code representing the state of config. State of the system could change not only on plugin system changes but also some properties of config could change too. In such cases the cache additionally checked against the version of config it's build for.Strictly speaking this hash should include the full state of config, but it would be too slow, so instead we check only for some of its properties.
-
getIntegration
Deprecated.since 3.3.2 -
getTransformerCache
Deprecated.since 3.3.2 -
getUrlCacheSize
public int getUrlCacheSize() -
getBatchingConfiguration
Deprecated. -
isDeferJsAttributeEnabled
Deprecated.since 5.0.0, use ResourcePriority.DEFER instead -
computeGlobalStateHash
Represents product state considering everything that contributes to content of resources.- Since:
- v3.5.0
-
getBeforeAllResources
-
getCdnResourceUrlTransformer
Returns a URL transformer to allow clients to map resource URLs as ingetResourceCdnPrefix(String).- Since:
- v3.5.0
-
isBundleHashValidationEnabled
public static boolean isBundleHashValidationEnabled()Determines if bundle hash validation for batch resources should be disabled.- Since:
- 4.3.5
-
isJavaScriptTryCatchWrappingEnabled
public boolean isJavaScriptTryCatchWrappingEnabled() -
isUrlCachingEnabled
public boolean isUrlCachingEnabled()- Returns:
- true if URL caching should be used.
-
getResourceFactory
-
isPerformanceTrackingEnabled
public boolean isPerformanceTrackingEnabled()- Returns:
- true if it should track performance/caching stats
-
getBooleanFromDarkFeatureManagerThenSystemProperty
Will do its best to return a result from DarkFeatureManager, but will fallback to System propertiesExists to de-couple the WRM from how products manage properties without having to add extra integration work during adoption to the
WebResourceIntegrationSPI- Parameters:
name- of the system property- Returns:
- true if flag is on
-