public class GadgetSpecUrlBuilder extends Object
| Constructor and Description |
|---|
GadgetSpecUrlBuilder(com.atlassian.sal.api.ApplicationProperties applicationProperties)
Constructs a new
GadgetSpecUrlBuilder that uses the specified ApplicationProperties to determine
the application base URL. |
| Modifier and Type | Method and Description |
|---|---|
String |
buildGadgetSpecFeedUrl()
Builds a URL for the feed containing all the gadget specs published by this application.
|
String |
buildGadgetSpecUrl(String pluginKey,
String moduleKey,
String location)
Builds a URL for the gadget spec that can be found with the
Plugin. |
com.atlassian.gadgets.plugins.PluginGadgetSpec.Key |
parseGadgetSpecUrl(String gadgetSpecUrl)
Parses a gadget spec URL in the format returned from
#buildGadgetSpecUrl(String, String) into a PluginResourceKey containing the plugin key and resource location specified by the URL. |
public GadgetSpecUrlBuilder(com.atlassian.sal.api.ApplicationProperties applicationProperties)
GadgetSpecUrlBuilder that uses the specified ApplicationProperties to determine
the application base URL.applicationProperties - ApplicationProperties implementation of the host application. Must not be
null, or a NullPointerException will be thrown.NullPointerException - if applicationProperties is nullpublic String buildGadgetSpecFeedUrl()
public String buildGadgetSpecUrl(String pluginKey, String moduleKey, String location)
Plugin.pluginKey - key of the Plugin in which the gadget spec can be found. Must not be null,
or a NullPointerException will be thrown.location - path to the gadget spec resource in the plugin. Must not be null, or a NullPointerException will be thrown.moduleKey - key of the GadgetModuleDescriptor. Must not be null,
or a NullPointerException will be thrown.NullPointerException - if any argument is nullpublic com.atlassian.gadgets.plugins.PluginGadgetSpec.Key parseGadgetSpecUrl(String gadgetSpecUrl)
#buildGadgetSpecUrl(String, String) into a PluginResourceKey containing the plugin key and resource location specified by the URL. The URL must contain
the standard resource prefix, and both a plugin key and resource location in the path. It may contain a module
key after the plugin key separated by a colon. If the URL is absolute, it must match the base URL for this
application.
For example:
rest/gadgets/1.0/g/test.plugin/path/to/gadget.xml http://localhost:8080/dashboards/rest/gadgets/1.0/g/test.plugin/path/to/gadget.xml)rest/gadgets/1.0/g/test.plugin:module-key/path/to/gadget.xmlhttp://localhost:8080/dashboards/rest/gadgets/1.0/g/test.plugin:module-key/path/to/gadget.xml)gadgetSpecUrl - a valid, URL-encoded gadget spec URL, as produced by #buildGadgetSpecUrl(String,
String) or #buildGadgetSpecUrl(com.atlassian.gadgets.plugins.PluginGadgetSpec.Key).
May be absolute, if the base URL matches the base URL retrieved from the ApplicationProperties instance this GadgetSpecUrlBuilder was initialized with. Must
not be null, or a NullPointerException will be thrown.PluginResourceKey built from the plugin key and resource location parsed and decoded from the
URLcom.atlassian.gadgets.GadgetSpecUriNotAllowedException - if the URL does not start with the prefix for gadget specs published from this
application, or if either the plugin key or resource location is missing or blankNullPointerException - if gadgetSpecUrl is nullCopyright © 2013 Atlassian. All Rights Reserved.