public class WebResourceUrlProviderImpl extends Object implements WebResourceUrlProvider
WebResourceUrlProvider.| Constructor and Description |
|---|
WebResourceUrlProviderImpl(WebResourceIntegration webResourceIntegration) |
| Modifier and Type | Method and Description |
|---|---|
String |
getBaseUrl()
Returns the base URL for this application.
|
String |
getBaseUrl(UrlMode urlMode)
Returns the base URL for this application in either relative or absolute format, depending on the value of
urlMode. |
String |
getResourceUrl(String moduleCompleteKey,
String resourceName)
Constructs and returns url for the given resource.
|
String |
getStaticPluginResourceUrl(com.atlassian.plugin.ModuleDescriptor moduleDescriptor,
String resourceName,
UrlMode urlMode)
A helper method to return a url for 'plugin' resources.
|
String |
getStaticPluginResourceUrl(String moduleCompleteKey,
String resourceName,
UrlMode urlMode)
A helper method to return a url for 'plugin' resources.
|
String |
getStaticResourcePrefix(String contributedHash,
String resourceCounter,
UrlMode urlMode)
A helper method to return a prefix for 'system' static resources.
|
String |
getStaticResourcePrefix(String resourceCounter,
UrlMode urlMode)
A helper method to return a prefix for 'system' static resources.
|
String |
getStaticResourcePrefix(UrlMode urlMode)
A helper method to return a prefix for 'system' static resources.
|
public WebResourceUrlProviderImpl(WebResourceIntegration webResourceIntegration)
public String getStaticResourcePrefix(UrlMode urlMode)
WebResourceUrlProvider
/s/{build num}/{system counter}/_
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/styles/global.css with <%= webResourceManager.getStaticResourcePrefix()
%>/styles/global.css
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode.
See UrlMode for details of the different options for URL format.
getStaticResourcePrefix in interface WebResourceUrlProviderurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to
decidepublic String getStaticResourcePrefix(String resourceCounter, UrlMode urlMode)
WebResourceUrlProviderGenerally the implementation will return
/s/{build num}/{system counter}/{resource counter}/_
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/styles/global.css with <%= webResourceManager.getStaticResourcePrefix(resourceCounter)
%>/styles/global.css
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode.
See UrlMode for details of the different options for URL format.
getStaticResourcePrefix in interface WebResourceUrlProviderresourceCounter - A number that represents the unique version of the resource you require. Every time this
resource changes, you need to increment the resource counterurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decidepublic String getStaticResourcePrefix(String contributedHash, String resourceCounter, UrlMode urlMode)
WebResourceUrlProviderGenerally the implementation will return
/s/{contributed Hash}/{build num}/{system counter}/{resource counter}/_
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/styles/global.css with <%= webResourceManager.getStaticResourcePrefix(resourceCounter)
%>/styles/global.css
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode.
See UrlMode for details of the different options for URL format.
getStaticResourcePrefix in interface WebResourceUrlProvidercontributedHash - hash contributed by resource mutators such as transforms or conditionsresourceCounter - A number that represents the unique version of the resource you require. Every time this
resource changes, you need to increment the resource counterurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decidepublic String getStaticPluginResourceUrl(String moduleCompleteKey, String resourceName, UrlMode urlMode)
WebResourceUrlProvider
/s/{build num}/{system counter}/{plugin version}/_/download/resources/plugin.key:module.key/resource.name
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/download/resources/plugin.key:module.key/resource.name with <%=
webResourceManager.getStaticPluginResource(descriptor, resourceName) %>
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode.
See UrlMode for details of the different options for URL format.
If a module with the given key cannot be found null is returned.
getStaticPluginResourceUrl in interface WebResourceUrlProvidermoduleCompleteKey - complete plugin module keyresourceName - the name of the resource as defined in the plugin manifesturlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decidepublic String getStaticPluginResourceUrl(com.atlassian.plugin.ModuleDescriptor moduleDescriptor, String resourceName, UrlMode urlMode)
WebResourceUrlProvider
/s/{build num}/{system counter}/{plugin version}/_/download/resources/plugin.key:module.key/resource.name
Note that the servlet context is prepended, and there is no trailing slash.
Typical usage is to replace:
<%= request.getContextPath() %>/download/resources/plugin.key:module.key/resource.name with <%=
webResourceManager.getStaticPluginResource(descriptor, resourceName) %>
This method returns a URL in either a relative or an absolute format, depending on the value of urlMode.
See UrlMode for details of the different options for URL format.
getStaticPluginResourceUrl in interface WebResourceUrlProvidermoduleDescriptor - plugin module descriptor that contains the resourceresourceName - the name of the resource as defined in the plugin manifesturlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete
implementation to decideWebResourceUrlProvider.getStaticPluginResourceUrl(String, String, UrlMode)public String getResourceUrl(String moduleCompleteKey, String resourceName)
WebResourceUrlProvidergetResourceUrl in interface WebResourceUrlProvidermoduleCompleteKey - a plugin module's complete keyresourceName - the name of the resource described in the modulepublic String getBaseUrl()
WebResourceUrlProvider
In general, the behavior of this method should be equivalent to calling WebResourceUrlProvider.getBaseUrl(UrlMode) with a urlMode value of UrlMode.AUTO.
getBaseUrl in interface WebResourceUrlProviderpublic String getBaseUrl(UrlMode urlMode)
WebResourceUrlProviderurlMode.
If urlMode == {@link UrlMode#ABSOLUTE}, this method returns an absolute URL, with URL
scheme, hostname, port (if non-standard for the scheme), and context path.
If urlMode == {@link UrlMode#RELATIVE}, this method returns a relative URL containing
just the context path.
If urlMode == {@link UrlMode#AUTO}, this method may return either an absolute or a
relative URL. Implementations are free to determine which mode to use based on any criteria of their choosing.
For example, an implementation may choose to return a relative URL if it detects that it is running in the
context of an HTTP request, and an absolute URL if it detects that it is not. Or it may choose to always return
an absolute URL, or always return a relative URL. Callers should only use WebResourceManager.UrlMode#AUTO when they are sure that either an absolute or a relative URL will be
appropriate, and should not rely on any particular observed behavior regarding how this value is interpreted,
which may vary across different implementations.
getBaseUrl in interface WebResourceUrlProviderurlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to
decideCopyright © 2019 Atlassian. All rights reserved.