public String getStaticPluginResourceUrl() { return webResourceUrlProvider.getStaticPluginResourceUrl("com.atlassian.confluence.plugins.socialbookmarking:bookmarks", "images/BookmarkIcon.gif", UrlMode.ABSOLUTE); } }
@Override public String getStaticResourcePrefix() { return webResourceUrlProvider.getStaticResourcePrefix(UrlMode.AUTO); }
/** * @param isAbsolute if url should be absolute or relative. * @return base url, where web resources is mounted to. */ public String getBaseUrl(boolean isAbsolute) { try { return joinWithSlashWithoutEmpty(urlProvider.getBaseUrl(isAbsolute ? UrlMode.ABSOLUTE : UrlMode.RELATIVE), AbstractFileServerServlet.SERVLET_PATH); } catch (AssertionError e) { // For unknown reason some links in Confluence (like /confluence/setup/setupstart.action ) doesn't // support the absolute base url, catching such cases and trying to use relative base url. if (isAbsolute && e.getMessage().contains("Unsupported URLMode")) { return getBaseUrl(false); } else { throw e; } } }
private String defaultIconUrl(String iconUrl, String defaultLocation) { if (isBlank(iconUrl)) { UrlBuilder urlBuilder = new UrlBuilder(webResourceUrlProvider.getBaseUrl(UrlMode.ABSOLUTE), false) .addPath("images") .addPath("project-templates") .addPath(defaultLocation); return urlBuilder.asUrlString(); } return iconUrl; } }
private String getImageUrl(String imageName) { return urlProvider.getStaticPluginResourceUrl(PluginConstants.PLUGIN_KEY + ":" + PluginConstants.HIPCHAT_JIRA_GLOBAL_IMAGE_RESOURCES, imageName, UrlMode.ABSOLUTE); } }
@Override public String call() throws Exception { return webResourceUrlProvider.getStaticResourcePrefix(com.atlassian.plugin.webresource.UrlMode.RELATIVE); } }).getOrNull();
private String getDefaultSharedLinksFavicon() { return webResourceUrlProvider.getStaticPluginResourceUrl(PluginConstants.SHARELINKS_RESOURCE_KEY, "default-sharelinks-favicon-16.png", UrlMode.ABSOLUTE); } }
/** * @return url prefix for resource, including base url. */ public String getResourceUrlPrefix(String hash, String version, boolean isAbsolute) { return urlProvider.getStaticResourcePrefix(hash, version, (isAbsolute ? UrlMode.ABSOLUTE : UrlMode.RELATIVE)) + "/" + AbstractFileServerServlet.SERVLET_PATH; }
@Override @Deprecated public String getStaticPluginResource(final String moduleCompleteKey, final String resourceName, final UrlMode urlMode) { return webResourceUrlProvider.getStaticPluginResourceUrl(moduleCompleteKey, resourceName, urlMode); }
@SuppressWarnings("unused") public String getStaticResourcePrefix() { return webResourceUrlProvider.getStaticResourcePrefix(UrlMode.ABSOLUTE); }
/** * @return "{base url}/s/{build num}/{system counter}/{plugin version}/_/download/resources/{plugin.key:module.key}/{resource.name}" */ @Override @Deprecated public String getStaticPluginResource(final ModuleDescriptor<?> moduleDescriptor, final String resourceName, final UrlMode urlMode) { return webResourceUrlProvider.getStaticPluginResourceUrl(moduleDescriptor, resourceName, urlMode); }
@Override public String getStaticResourcePrefix(String resourceCounter) { return webResourceUrlProvider.getStaticResourcePrefix(resourceCounter, UrlMode.AUTO); } }
/** * Returns the publicly-accessible URL for this Icon. * * @return a String containing the icon URL */ public String url() { if (isBlank(location)) { return ""; } return webResourceUrlProvider.getStaticPluginResourceUrl(moduleKey, resourceName, UrlMode.AUTO); } }
public String getAbsoluteLogoUrl() { String jiraLogo = getLogoUrl(); if (jiraLogo != null && !jiraLogo.startsWith("http://") && !jiraLogo.startsWith("https://")) { jiraLogo = ComponentAccessor.getComponent(WebResourceUrlProvider.class).getStaticResourcePrefix(UrlMode.AUTO) + jiraLogo; } return jiraLogo; }
@Override public String apply(Object... args) { final String plugin = String.valueOf(args[0]); final String resource = String.valueOf(args[1]); final UrlMode urlMode; if (args.length > 2) { urlMode = UrlMode.valueOf(String.valueOf(args[2])); } else { urlMode = UrlMode.RELATIVE; } return webResourceUrlProvider.getStaticPluginResourceUrl(plugin, resource, urlMode); } }
public UserProfileLink(String username, I18NBean i18n) { super(username, i18n); this.profilePicture = userAccessor.getUserProfilePicture(user); this.staticResourceUrlPrefix = ((WebResourceUrlProvider) ContainerManager.getComponent("webResourceUrlProvider")).getStaticResourcePrefix(UrlMode.AUTO); }
@Nullable public URI getIconUri() { try { return new URI(webResourceUrlProvider.getStaticPluginResourceUrl(pluginUtil.getPluginKey() + ":applinks-images", "images", UrlMode.ABSOLUTE) + "/config/logos/128x128/128" + getIconKey() + ".png"); } catch (URISyntaxException e) { LOG.warn("Unable to find the icon for this application type.", e); return null; } } }
@Override public Map<String, Object> getTemplateParams() { // NOTE: if adding a parameter here please update the doc online at // https://developer.atlassian.com/display/JIRADEV/Velocity+Context+for+Email+Templates final I18nHelper i18nHelper = beanFactory.getInstance(locale); final Map<String, Object> templateParams = Maps.newHashMap(); templateParams.put("i18n", i18nHelper); final OutlookDate formatter = new OutlookDate(locale); templateParams.put("dateformatter", formatter); final LookAndFeelBean landf = LookAndFeelBean.getInstance(applicationProperties); templateParams.put("lfbean", landf); templateParams.put("baseurl", applicationProperties.getString(APKeys.JIRA_BASEURL)); String jiraLogo = landf.getLogoUrl(); if (jiraLogo != null && !jiraLogo.startsWith("http://") && !jiraLogo.startsWith("https://")) { jiraLogo = resourceUrlProvider.getStaticResourcePrefix(UrlMode.ABSOLUTE) + jiraLogo; } templateParams.put("jiraLogoUrl", jiraLogo); return templateParams; } }
@Nullable public URI getIconUrl() { try { return new URI(webResourceUrlProvider.getStaticPluginResourceUrl(pluginUtil.getPluginKey() + ":applinks-images", "images", UrlMode.ABSOLUTE) + "/types/16" + getIconKey() + ".png"); } catch (URISyntaxException e) { LOG.warn("Unable to find the icon for this application type.", e); return null; } }
if (jiraLogo != null && !jiraLogo.startsWith("http://") && !jiraLogo.startsWith("https://")) jiraLogo = webResourceUrlProvider.getStaticResourcePrefix(UrlMode.AUTO) + jiraLogo;