/** * Return href with '/' -prefix and removed possible ?[fileHash]. * * Used in matching, when serving images. * * @return href with '/' -prefix and removed possible ?[fileHash] */ public String getRelHref() { String[] split = getHref().split("\\?"); return "/" + split[0]; }
/** * Gets the cache-string used in Google Workbox caching. * * @return "{ url: '[href]', revision: '[fileHash' }" */ public String getCacheFormat() { return String.format("{ url: '%s', revision: '%s' }", getHref(), fileHash); }
private String initializeInstallPrompt(PwaConfiguration pwaConfiguration) { PwaIcon largest = getIcons().stream().filter(PwaIcon::shouldBeCached) .min((icon1, icon2) -> icon2.getWidth() - icon1.getWidth()) .orElse(null); return BootstrapHandler.readResource("default-pwa-prompt.html") .replace("%%%INSTALL%%%", "Install") .replace("%%%LOGO_PATH%%%", largest == null ? "" : pwaConfiguration.getRootUrl() + largest.getHref()) .replace("%%%PROJECT_NAME%%%", pwaConfiguration.getAppName()); }
largest != null ? pwaConfiguration.getRootUrl() + largest.getHref() : "") .replace("%%%META_ICONS%%%", iconHead);
for (PwaIcon icon : getManifestIcons()) { JsonObject iconData = Json.createObject(); iconData.put("src", icon.getHref()); iconData.put("sizes", icon.getSizes()); iconData.put("type", icon.getType());