Package com.vaadin.flow.server
Class PwaRegistry
- java.lang.Object
-
- com.vaadin.flow.server.PwaRegistry
-
- All Implemented Interfaces:
Serializable
public class PwaRegistry extends Object implements Serializable
Registry for PWA data. Includes:PwaConfiguration- basic info- List of
PwaIcon:s - different sizes of icons for header and manifest - Offline page
- Manifest json
- Service worker
- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PwaRegistry(PWA pwa, javax.servlet.ServletContext servletContext)Creates a new PwaRegistry instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<PwaIcon>getHeaderIcons()List ofPwaIcon:s that should be added to header.List<PwaIcon>getIcons()List of all icons managed byPwaRegistry.static List<PwaIcon>getIconTemplates(String baseName)Gets all PWA icon variants for the give base icon.static PwaRegistrygetInstance(javax.servlet.ServletContext servletContext)Gets the pwa registry for the given servlet context.List<PwaIcon>getManifestIcons()List ofPwaIcon:s that should be added to manifest.webmanifest.StringgetManifestJson()manifest.webmanifest contents as a String.StringgetOfflineHtml()Static offline page as String.PwaConfigurationgetPwaConfiguration()StringgetRuntimeServiceWorkerJs()sw-runtime.js (service worker JavaScript for precaching runtime generated resources) as a String.
-
-
-
Constructor Detail
-
PwaRegistry
public PwaRegistry(PWA pwa, javax.servlet.ServletContext servletContext) throws IOException
Creates a new PwaRegistry instance.- Parameters:
pwa- the pwa annotationservletContext- the context- Throws:
IOException- when icon or offline resources are not found.
-
-
Method Detail
-
getInstance
public static PwaRegistry getInstance(javax.servlet.ServletContext servletContext)
Gets the pwa registry for the given servlet context. If the servlet context has no pwa registry, a new instance is created and assigned to the context.- Parameters:
servletContext- the servlet context for which to get a route registry, notnull- Returns:
- a registry instance for the given servlet context, not
null
-
getOfflineHtml
public String getOfflineHtml()
Static offline page as String.- Returns:
- contents of offline page
-
getManifestJson
public String getManifestJson()
manifest.webmanifest contents as a String.- Returns:
- contents of manifest.webmanifest
-
getRuntimeServiceWorkerJs
public String getRuntimeServiceWorkerJs()
sw-runtime.js (service worker JavaScript for precaching runtime generated resources) as a String.- Returns:
- contents of sw-runtime.js
-
getHeaderIcons
public List<PwaIcon> getHeaderIcons()
List ofPwaIcon:s that should be added to header.- Returns:
- List of
PwaIcon:s that should be added to header
-
getManifestIcons
public List<PwaIcon> getManifestIcons()
List ofPwaIcon:s that should be added to manifest.webmanifest.- Returns:
- List of
PwaIcon:s that should be added to manifest.webmanifest
-
getIcons
public List<PwaIcon> getIcons()
List of all icons managed byPwaRegistry.- Returns:
- List of all icons managed by
PwaRegistry
-
getPwaConfiguration
public PwaConfiguration getPwaConfiguration()
-
-