Class Router
java.lang.Object
com.atlassian.plugin.webresource.impl.support.http.BaseRouter<Controller>
com.atlassian.plugin.webresource.impl.http.Router
Generates urls and route requests to proper handlers.
- Since:
- 3.3
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.plugin.webresource.impl.support.http.BaseRouter
BaseRouter.Handler, BaseRouter.Route -
Field Summary
Fields inherited from class com.atlassian.plugin.webresource.impl.support.http.BaseRouter
globals, routes, useAbsoluteUrl -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRouter(Globals globals, List<BaseRouter<Controller>.Route> routes, boolean useAbsoluteUrl) Needed to support legacy API. -
Method Summary
Modifier and TypeMethodDescriptionbuildUrlWithPrefix(String url, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String hash, String bundleHash) Adds prefix to relative url.cloneWithNewUrlMode(boolean useAbsoluteUrl) Needed to support legacy API.contextBatchSourceMapUrl(String key, String type, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) contextBatchUrl(String key, String type, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) Url helpers.protected ControllercreateController(Globals globals, Request request, Response response) Override this method and provide instance of the controller.static RawRequestdecodeContexts(String encodedContexts) Decodes context key like `batch1,batch2,-excludedBatch3,-excludedBatch4` into lists of included and excluded contexts.static StringencodeContexts(Collection<String> includedContexts, Iterable<String> excludedContexts) Encodes lists of included and excluded contexts into single key like `batch1,batch2,-excludedBatch3, -excludedBatch4`.static StringescapeSlashes(String string) pluginResourceUrl(String pluginKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) prebuildSourceUrl(Resource resource) prebuildSourceUrl(String completeKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) resourceSourceMapUrl(String completeKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) resourceUrl(String completeKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) static StringresourceUrlRelativeToContextBatch(String key, String type, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) resourceUrlRelativeToWebResourceBatch(String completeKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) resourceUrlWithoutHash(Resource resource, Map<String, String> params) sourceMapUrl(String resourceUrl, Map<String, String> generatedParams) static StringsourceMapUrlToUrl(String sourceMapUrl) Converting source map url to url, removes `.map` from url.sourceUrl(String completeKey, String resourceName, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) static StringunescapeSlashes(String string) webResourceBatchUrl(String completeKey, String type, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) It is important for the url structure to be: 1.Methods inherited from class com.atlassian.plugin.webresource.impl.support.http.BaseRouter
addRoute, buildUrl, buildUrl, callHandler, canDispatch, dispatch, interpolate, isUrlTooLong, joinWithSlashWithoutEmpty, parseWithRe, routeToRe
-
Constructor Details
-
Router
-
Router
protected Router(Globals globals, List<BaseRouter<Controller>.Route> routes, boolean useAbsoluteUrl) Needed to support legacy API.
-
-
Method Details
-
resourceUrlAsStaticMethod
-
encodeContexts
public static String encodeContexts(Collection<String> includedContexts, Iterable<String> excludedContexts) Encodes lists of included and excluded contexts into single key like `batch1,batch2,-excludedBatch3, -excludedBatch4`. -
decodeContexts
Decodes context key like `batch1,batch2,-excludedBatch3,-excludedBatch4` into lists of included and excluded contexts. -
sourceMapUrlToUrl
Converting source map url to url, removes `.map` from url. -
escapeSlashes
-
unescapeSlashes
-
contextBatchUrl
public String contextBatchUrl(String key, String type, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) Url helpers. -
contextBatchSourceMapUrl
-
resourceUrlRelativeToContextBatch
-
resourceUrl
-
resourceSourceMapUrl
-
pluginResourceUrl
-
resourceUrlWithoutHash
-
sourceUrl
-
prebuildSourceUrl
-
sourceUrl
-
prebuildSourceUrl
-
webResourceBatchUrl
public String webResourceBatchUrl(String completeKey, String type, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash) It is important for the url structure to be: 1. the same number of sectioned paths as the SinglePluginResource 2. include the module complete key in the path before the resource name This is due to css resources referencing other resources such as images in relative path forms. -
resourceUrlRelativeToWebResourceBatch
-
sourceMapUrl
-
cloneWithNewUrlMode
Needed to support legacy API. -
buildUrlWithPrefix
public String buildUrlWithPrefix(String url, Map<String, String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String hash, String bundleHash) Adds prefix to relative url. -
createController
Description copied from class:BaseRouterOverride this method and provide instance of the controller.- Specified by:
createControllerin classBaseRouter<Controller>
-