|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WebResourceUrlProvider
Provides the prefixes a 'system' static resource as well as the base url of the application to be used as a prefix for other web resources.
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 pluginModuleKey,
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 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. |
Method Detail |
---|
String getStaticResourcePrefix(UrlMode urlMode)
/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.
urlMode
- specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to
decide
String getStaticResourcePrefix(String resourceCounter, UrlMode urlMode)
/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.
resourceCounter
- 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
String getStaticPluginResourceUrl(String moduleCompleteKey, String resourceName, UrlMode urlMode)
/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.
moduleCompleteKey
- 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
String getStaticPluginResourceUrl(com.atlassian.plugin.ModuleDescriptor<?> moduleDescriptor, String resourceName, UrlMode urlMode)
/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.
moduleDescriptor
- 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
getStaticPluginResourceUrl(String, String, UrlMode)
String getResourceUrl(String pluginModuleKey, String resourceName)
pluginModuleKey
- a plugin module's complete keyresourceName
- the name of the resource described in the moduleString getBaseUrl()
getBaseUrl(UrlMode)
with a urlMode
value of UrlMode.AUTO
.
String getBaseUrl(UrlMode urlMode)
urlMode
.
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.
urlMode
- 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 |