public class Config extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Config.IntermediaryContextData |
protected static class |
Config.WebModuleDescriptor |
| Constructor and Description |
|---|
Config(ResourceBatchingConfiguration batchingConfiguration,
WebResourceIntegration integration,
WebResourceUrlProvider urlProvider,
com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory,
TransformerCache transformerCache,
ResourceCompiler resourceCompiler) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
amdEnabled() |
protected Resource |
buildResource(Bundle bundle,
com.atlassian.plugin.elements.ResourceLocation resourceLocation)
Helper to hide bunch of integration code and simplify resource creation.
|
String |
computeGlobalStateHash()
Represents product state considering everything that contributes to content of resources.
|
protected void |
ensureNoLegacyStuff(Snapshot snapshot)
Analyzes current state of the plugin system and return web resources.
|
String |
getBaseUrl() |
String |
getBaseUrl(boolean isAbsolute) |
ResourceBatchingConfiguration |
getBatchingConfiguration()
Deprecated.
|
List<String> |
getBeforeAllResources() |
boolean |
getBigPipeDeadlineDisabled() |
File |
getCacheDirectory() |
CdnResourceUrlTransformer |
getCdnResourceUrlTransformer()
Returns a URL transformer to allow clients to map resource URLs as in
getResourceCdnPrefix(String). |
ResourceContentAnnotator |
getContentAnnotator(String type) |
int |
getContentCacheSize() |
String |
getContentType(String path) |
String |
getCtCdnBaseUrl()
Returns the CDN base URL to prefix all pre-baked resources mapped with
WebResourceMapper. |
TimeSpan |
getDefaultBigPipeDeadline() |
int |
getIncrementalCacheSize() |
WebResourceIntegration |
getIntegration()
Deprecated.
since 3.3.2
|
Resource |
getModuleResource(String completeKey,
String name)
Get not declared Resource.
|
Resource |
getPluginResource(String pluginKey,
String name)
Get Resource for Plugin.
|
static String |
getPluginVersionOrInstallTime(com.atlassian.plugin.Plugin plugin,
boolean usePluginInstallTimeInsteadOfTheVersionForSnapshotPlugins)
For SNAPSHOT plugins will return install time instead of the version.
|
String |
getResourceCdnPrefix(String url) |
ResourceCompiler |
getResourceCompiler() |
protected static List<com.atlassian.plugin.elements.ResourceLocation> |
getResourceLocations(WebResourceModuleDescriptor webResourceModuleDescriptor,
boolean compiledResourcesEnabled) |
LinkedHashMap<String,Resource> |
getResourcesWithoutCache(Bundle bundle)
Queries the plugin system and return list of Resources for Web Resource.
|
String |
getResourceUrlPrefix(String hash,
String version,
boolean isAbsolute) |
StaticTransformers |
getStaticTransformers() |
InputStream |
getStreamFor(Resource resource,
String path)
Returns stream for file with given location for given resource.
|
TransformerCache |
getTransformerCache()
Deprecated.
since 3.3.2
|
int |
getUrlCacheSize() |
LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> |
getWebResourceData(String key)
Get data resources for web resource.
|
WebResourceMapper |
getWebResourceMapper()
Returns the current instance of
WebResourceMapper or no-op when
WebResourceIntegration.isCtCdnMappingEnabled() is false. |
Snapshot |
getWebResourcesWithoutCache()
Analyzes current state of the plugin system and return web resources.
|
boolean |
ignorePrebakeWarnings()
This property indicates if resources tainted only with
PrebakeWarnings should be considered for prebaking. |
boolean |
isBatchContentTrackingEnabled() |
boolean |
isCdnEnabled() |
boolean |
isContentCacheEnabled() |
boolean |
isContextBatchingEnabled() |
static boolean |
isContextKey(String key)
If the key is context or web resource key.
|
boolean |
isCSSPrebakingEnabled()
Returns true if CSS prebaking is enabled, false otherwise
|
boolean |
isDeferJsAttributeEnabled() |
boolean |
isGlobalMinificationEnabled()
Determines if global minification of resources is enabled based on a System Property.
|
boolean |
isIncrementalCacheEnabled()
If incremental cache enabled.
|
boolean |
isJavaScriptTryCatchWrappingEnabled() |
boolean |
isMinificationEnabled()
If minification enabled.
|
boolean |
isPreBakeEnabled()
Determines if pre-baker REST API is enabled based on a System Property..
|
boolean |
isSourceMapEnabled() |
boolean |
isSourceMapEnabledFor(String typeOrContentType) |
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.
|
boolean |
isSuperBatchingEnabled() |
boolean |
isSyncContextCreated() |
boolean |
isUrlCachingEnabled()
If URL caching enabled, used mostly to simplify debugging.
|
boolean |
isUrlGenerationCacheEnabled() |
boolean |
isWebResourceBatchingEnabled() |
static boolean |
isWebResourceKey(String completeKey)
If `completeKey` is Web Resource key or Plugin key.
|
static String |
nameAndLoaderToNameWithExtension(String loader,
String name) |
static String |
nameAndLoaderToNameWithLoader(String loader,
String name) |
boolean |
optimiseSourceMapsForDevelopment() |
protected Map<String,List<Config.WebModuleDescriptor>> |
parseAtlassianModules(com.atlassian.plugin.Plugin plugin) |
protected void |
parseModules(Snapshot snapshot,
Map<String,Bundle> cachedBundles,
ConditionInstanceCache conditionInstanceCache,
Map<WebResource,CachedCondition> webResourcesCondition,
Map<WebResource,CachedTransformers> webResourcesTransformations,
Map<String,Config.IntermediaryContextData> intermediaryContexts) |
static Tuple<String,String> |
parseNameWithLoader(String name) |
int |
partialHashCode()
Hash code representing the state of config.
|
void |
reloadWebResourceMapper()
Forces the creation of a new instance of
WebResourceMapper, resetting the current reference to it. |
boolean |
resplitMergedContextBatchesForThisRequest() |
void |
runResourceCompilation(Snapshot snapshot) |
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.
|
void |
setStaticTransformers(StaticTransformers staticTransformers) |
boolean |
useAsyncAttributeForScripts()
Use async attribute for script tags.
|
boolean |
useConditionsForWebModules()
If conditions should be enabled for AMD modules.
|
static String |
virtualContextKeyToWebResourceKey(String virtualContextKey)
Convert virtual context key to web resource key.
|
public static final String IEONLY_PARAM_NAME
public static final String SOURCE_PARAM_NAME
public static final String BATCH_PARAM_NAME
public static final String MEDIA_PARAM_NAME
public static final String CONTENT_TYPE_PARAM_NAME
public static final String CACHE_PARAM_NAME
public static final String CONDITIONAL_COMMENT_PARAM_NAME
public static final String ASYNC_SCRIPT_PARAM_NAME
public static final String INITIAL_RENDERED_SCRIPT_PARAM_NAME
public static final String WRM_KEY_PARAM_NAME
public static final String WRM_BATCH_TYPE_PARAM_NAME
public static final String DOWNLOAD_PARAM_VALUE
public static final String JS_TYPE
public static final String JS_CONTENT_TYPE
public static final String CSS_TYPE
public static final String CSS_CONTENT_TYPE
public static final String SOY_TYPE
public static final String CSS_EXTENSION
public static final String LESS_EXTENSION
public static final String JS_EXTENSION
public static final String SOY_EXTENSION
public static final String[] BATCH_TYPES
public static final String WEB_RESOURCE_MODULE_LOADER
public static final int GET_URL_MAX_LENGTH
public static final String[] HTTP_PARAM_NAMES
public static final String ATLASSIAN_MODULES_XML
public static final String CONTEXT_PREFIX
public static final String SUPER_BATCH_CONTEXT_KEY
public static final String SUPERBATCH_KEY
public static final String SYNCBATCH_CONTEXT_KEY
public static final String SYNCBATCH_KEY
public static final String IN_ORDER_LOADER_RESOURCE_KEY
public static final String INCREMENTAL_CACHE_SIZE
public Config(ResourceBatchingConfiguration batchingConfiguration, WebResourceIntegration integration, WebResourceUrlProvider urlProvider, com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory, TransformerCache transformerCache, ResourceCompiler resourceCompiler)
public void setContentTypeResolver(com.atlassian.plugin.servlet.ContentTypeResolver contentTypeResolver)
public void setStaticTransformers(StaticTransformers staticTransformers)
public boolean isContentCacheEnabled()
public int getContentCacheSize()
public int getIncrementalCacheSize()
public File getCacheDirectory()
public boolean isSourceMapEnabledFor(String typeOrContentType)
typeOrContentType - type or content type.public boolean isSourceMapEnabled()
public boolean isCdnEnabled()
public String getBaseUrl()
public String getBaseUrl(boolean isAbsolute)
isAbsolute - if url should be absolute or relative.public String getResourceUrlPrefix(String hash, String version, boolean isAbsolute)
public String getResourceCdnPrefix(String url)
public ResourceContentAnnotator getContentAnnotator(String type)
public boolean useAsyncAttributeForScripts()
public StaticTransformers getStaticTransformers()
public static boolean isContextKey(String key)
public static String virtualContextKeyToWebResourceKey(String virtualContextKey)
protected void ensureNoLegacyStuff(Snapshot snapshot)
public boolean isSyncContextCreated()
public Snapshot getWebResourcesWithoutCache()
protected void parseModules(Snapshot snapshot, Map<String,Bundle> cachedBundles, ConditionInstanceCache conditionInstanceCache, Map<WebResource,CachedCondition> webResourcesCondition, Map<WebResource,CachedTransformers> webResourcesTransformations, Map<String,Config.IntermediaryContextData> intermediaryContexts)
public static String nameAndLoaderToNameWithExtension(String loader, String name)
public static String nameAndLoaderToNameWithLoader(String loader, String name)
protected Map<String,List<Config.WebModuleDescriptor>> parseAtlassianModules(com.atlassian.plugin.Plugin plugin)
public LinkedHashMap<String,Resource> getResourcesWithoutCache(Bundle bundle)
protected static List<com.atlassian.plugin.elements.ResourceLocation> getResourceLocations(WebResourceModuleDescriptor webResourceModuleDescriptor, boolean compiledResourcesEnabled)
public LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getWebResourceData(String key)
public InputStream getStreamFor(Resource resource, String path)
public boolean isMinificationEnabled()
protected Resource buildResource(Bundle bundle, com.atlassian.plugin.elements.ResourceLocation resourceLocation)
public Resource getModuleResource(String completeKey, String name)
public Resource getPluginResource(String pluginKey, String name)
public boolean optimiseSourceMapsForDevelopment()
public boolean isSuperBatchingEnabled()
public boolean isBatchContentTrackingEnabled()
public boolean isContextBatchingEnabled()
public boolean isWebResourceBatchingEnabled()
public boolean isIncrementalCacheEnabled()
public static boolean isWebResourceKey(String completeKey)
public int partialHashCode()
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.
@Deprecated public WebResourceIntegration getIntegration()
@Deprecated public TransformerCache getTransformerCache()
public boolean isUrlGenerationCacheEnabled()
public int getUrlCacheSize()
@Deprecated public ResourceBatchingConfiguration getBatchingConfiguration()
public boolean isDeferJsAttributeEnabled()
public TimeSpan getDefaultBigPipeDeadline()
public boolean getBigPipeDeadlineDisabled()
public String computeGlobalStateHash()
public boolean useConditionsForWebModules()
public CdnResourceUrlTransformer getCdnResourceUrlTransformer()
getResourceCdnPrefix(String).public boolean isPreBakeEnabled()
public static boolean isStaticContextOrderEnabled()
public boolean isGlobalMinificationEnabled()
public String getCtCdnBaseUrl()
WebResourceMapper.public ResourceCompiler getResourceCompiler()
public void runResourceCompilation(Snapshot snapshot)
public boolean resplitMergedContextBatchesForThisRequest()
public boolean amdEnabled()
public WebResourceMapper getWebResourceMapper()
WebResourceMapper or no-op when
WebResourceIntegration.isCtCdnMappingEnabled() is false.public void reloadWebResourceMapper()
throws Exception
WebResourceMapper, resetting the current reference to it.
If the new instance is NoOpWebResourceMapper and NoOpWebResourceMapper.reason() returns an
exception, then this exception is thrown.Exception - Reason why NoOpWebResourceMapper and not an operational instance was created.public boolean isJavaScriptTryCatchWrappingEnabled()
public static String getPluginVersionOrInstallTime(com.atlassian.plugin.Plugin plugin, boolean usePluginInstallTimeInsteadOfTheVersionForSnapshotPlugins)
public boolean isCSSPrebakingEnabled()
public boolean ignorePrebakeWarnings()
PrebakeWarnings should be considered for prebaking.
It is important to note that resources tainted with
PrebakeErrors will never be considered safe for
prebaking, even when this property is set.
PrebakeWarnings, false otherwisepublic boolean isUrlCachingEnabled()
Copyright © 2018 Atlassian. All rights reserved.