|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.plugin.webresource.WebResourceUrlProviderImpl
public class WebResourceUrlProviderImpl
The default implementation of WebResourceUrlProvider.
| Constructor Summary | |
|---|---|
WebResourceUrlProviderImpl(WebResourceIntegration webResourceIntegration)
|
|
| Method Summary | |
|---|---|
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(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 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebResourceUrlProviderImpl(WebResourceIntegration webResourceIntegration)
| Method Detail |
|---|
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
decide
public String getStaticResourcePrefix(String resourceCounter,
UrlMode urlMode)
WebResourceUrlProvider/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 decide
public 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 decide
public String getStaticPluginResourceUrl(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 decide
WebResourceUrlProvider.getStaticPluginResourceUrl(String, String, UrlMode)
public String getResourceUrl(String moduleCompleteKey,
String resourceName)
WebResourceUrlProvider
getResourceUrl in interface WebResourceUrlProvidermoduleCompleteKey - a plugin module's complete keyresourceName - the name of the resource described in the modulepublic String getBaseUrl()
WebResourceUrlProviderWebResourceUrlProvider.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
decide
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||