public class ResourceServingHelpers extends UrlGenerationHelpers
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
ResourceServingHelpers.RepairSourceMapChainCallback |
UrlGenerationHelpers.CalculatedBatches, UrlGenerationHelpers.ContextBatch, UrlGenerationHelpers.ContextBatchKey, UrlGenerationHelpers.ParamsComparator, UrlGenerationHelpers.Resolved, UrlGenerationHelpers.SplitSubBatches, UrlGenerationHelpers.SubBatch, UrlGenerationHelpers.WebResourceBatchBaseHelpers.BundleFinder, BaseHelpers.Found, BaseHelpers.ResourceFinder| Constructor and Description |
|---|
ResourceServingHelpers() |
| Modifier and Type | Method and Description |
|---|---|
protected static Content |
applyStaticTransformers(Globals globals,
Resource resource,
Content content,
Map<String,String> params,
String sourceUrl)
Apply Static Transformers to Resource.
|
protected static Content |
applyTransformers(Globals globals,
Resource resource,
Content content,
Map<String,String> params,
String sourceUrl)
Apply Transformers to Resource.
|
static Content |
asContent(com.atlassian.plugin.servlet.DownloadableResource downloadableResource,
com.atlassian.sourcemap.SourceMap sourceMap,
boolean isTransformed)
Adapter, turns DownloadableResource into Content.
|
static com.atlassian.plugin.servlet.DownloadableResource |
asDownloadableResource(Content content)
Adapter, turns Content into DownloadableResource.
|
static Content |
buildEmptyContent(String contentType) |
static String |
buildKey(Globals globals,
Resource resource,
Map<String,String> params)
The `params` contains all the params from url, so if we build the key using all params it will
be correct but inefficient for the caching.
|
static Content |
buildSafeContent(Content content,
String fullResourceName)
Intercept any exception and ignores it.
|
static Resource |
getModuleResource(Globals globals,
String completeKeyOrPluginKey,
String resourceName)
Get Resource for non WebResource Module.
|
protected static String |
getPluginKey(String completeKeyOrPluginKey)
In case of Plugin Key - returns the same key, in case of Web Resource key - extracts Plugin key from it.
|
protected static Resource |
getPluginResource(Globals globals,
String completeKeyOrPluginKey,
String resourceName)
Get Resource for Plugin.
|
static Resource |
getResource(RequestCache requestCache,
Collection<String> bundles,
String resourceName)
Get Resource for one of Web Resources.
|
static Resource |
getResource(RequestCache requestCache,
String completeKey,
String resourceName)
Get resource for Web Resource or Plugin, also resolves relative paths.
|
protected static Resource |
getResourceRelativeToPlugin(Globals globals,
String completeKeyOrPluginKey,
String resourceName)
Deprecated.
since v3.3.2
|
protected static Resource |
getResourceRelativeToWebResource(RequestCache requestCache,
String completeKey,
String resourceName)
Deprecated.
since v3.3.2
|
protected static Resource |
getWebResourceResource(RequestCache requestCache,
String completeKey,
String resourceName)
Get Resource for Web Resource.
|
protected static Content |
repairSourceMapChain(Content input,
ResourceServingHelpers.RepairSourceMapChainCallback cb)
Some transformers doesn't support source map, the result is that the source map chain is broken and
not working.
|
static com.google.common.base.Predicate<Resource> |
shouldBeIncludedInBatch(String type,
Map<String,String> params)
Select Resources that should be included in batch.
|
static String[] |
splitLastPathPart(String resourcePath)
Deprecated.
since v3.3.2
|
static Content |
transform(Globals globals,
LinkedHashSet<String> requiredResources,
String url,
Resource resource,
Map<String,String> params,
boolean applyAnnotators)
Transform given Resource by applying Transformers and Static Transformers.
|
static Content |
transform(Globals globals,
LinkedHashSet<String> requiredResources,
String url,
String type,
com.google.common.base.Supplier<Collection<Resource>> resources,
Map<String,String> params)
Apply conditions and transformations to list of Resources and generate resulting Batch.
|
static Content |
transformSafely(Globals globals,
LinkedHashSet<String> requiredResources,
String url,
Resource resource,
Map<String,String> params,
boolean applyAnnotators)
Transform given Resource by applying Transformers and Static Transformers.
|
static Content |
transformWithoutCache(Globals globals,
LinkedHashSet<String> requiredResources,
String url,
Resource resource,
Map<String,String> params,
boolean applyAnnotators)
Transform given Resource by applying Transformers and Static Transformers.
|
buildDataResources, buildIncludedExcludedConditionsAndBatchingOptions, calculateBatches, collectUrlStateAndBuildResourceUrls, createResourceUrlsForRedirectResources, encodeStateInUrlIfSupported, encodeStateInUrlIfSupported, getConditions, resolve, resolveExcluded, resourcesOfType, splitBatchIntoSubBatches, splitIntoSubBatchesfind, find, findItChangesArguments, getResources, hasConditions, hasLegacyCondition, isConditionsSatisfied, isConditionsSatisfiedpublic static Resource getResource(RequestCache requestCache, String completeKey, String resourceName)
completeKey - key of web resource or plugin.resourceName - name of Resource.public static Resource getResource(RequestCache requestCache, Collection<String> bundles, String resourceName)
bundles - list of keys of Web Resources.resourceName - name of Resource.public static Content transform(Globals globals, LinkedHashSet<String> requiredResources, String url, String type, com.google.common.base.Supplier<Collection<Resource>> resources, Map<String,String> params)
resources - list of Resourcesparams - http params.public static Content transform(Globals globals, LinkedHashSet<String> requiredResources, String url, Resource resource, Map<String,String> params, boolean applyAnnotators)
resource - the resource.params - http params.public static String buildKey(Globals globals, Resource resource, Map<String,String> params)
If we can detect the subset of params that's actually used by transformers fot the given resource we would be able to provide better cache hit ratio. This method calculates the key in the smart way, using only those parameters that are actually used.
public static Content transformWithoutCache(Globals globals, LinkedHashSet<String> requiredResources, String url, Resource resource, Map<String,String> params, boolean applyAnnotators)
resource - the resource.params - http params.public static Content transformSafely(Globals globals, LinkedHashSet<String> requiredResources, String url, Resource resource, Map<String,String> params, boolean applyAnnotators)
resource - the resource.params - http params.public static com.google.common.base.Predicate<Resource> shouldBeIncludedInBatch(String type, Map<String,String> params)
type - type of batch.params - http params of batch.public static com.atlassian.plugin.servlet.DownloadableResource asDownloadableResource(Content content)
public static Content asContent(com.atlassian.plugin.servlet.DownloadableResource downloadableResource, com.atlassian.sourcemap.SourceMap sourceMap, boolean isTransformed)
public static Content buildSafeContent(Content content, String fullResourceName)
protected static Content applyTransformers(Globals globals, Resource resource, Content content, Map<String,String> params, String sourceUrl)
resource - resource.content - content of resource.params - http params.sourceUrl - url of source code for resource.protected static Content repairSourceMapChain(Content input, ResourceServingHelpers.RepairSourceMapChainCallback cb)
protected static Content applyStaticTransformers(Globals globals, Resource resource, Content content, Map<String,String> params, String sourceUrl)
resource - resource.content - content of resource.params - http params.sourceUrl - url of source code for resource.protected static Resource getWebResourceResource(RequestCache requestCache, String completeKey, String resourceName)
completeKey - complete key of Web Resource.resourceName - name of Resource.public static Resource getModuleResource(Globals globals, String completeKeyOrPluginKey, String resourceName)
completeKeyOrPluginKey - complete key or plugin key.resourceName - name of Resource.@Deprecated protected static Resource getResourceRelativeToWebResource(RequestCache requestCache, String completeKey, String resourceName)
protected static Resource getPluginResource(Globals globals, String completeKeyOrPluginKey, String resourceName)
completeKeyOrPluginKey - complete key or plugin key.resourceName - name of Resource.@Deprecated protected static Resource getResourceRelativeToPlugin(Globals globals, String completeKeyOrPluginKey, String resourceName)
@Deprecated public static String[] splitLastPathPart(String resourcePath)
Copyright © 2019 Atlassian. All rights reserved.