com.vaadin.flow.server.
Class PwaRegistry
All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionPwaRegistry
(PWA pwa, jakarta.servlet.ServletContext servletContext) Creates a new PwaRegistry instance.
-
Method Summary
Modifier and TypeMethodDescriptionList of
PwaIcon
:s that should be added to header.getIcons()
List of all icons managed by
PwaRegistry
.getIconTemplates
(String baseName) Gets all PWA icon variants for the give base icon.
static PwaRegistry
getInstance
(jakarta.servlet.ServletContext servletContext) Gets the pwa registry for the given servlet context.
List of
PwaIcon
:s that should be added to manifest.webmanifest.manifest.webmanifest contents as a String.
Static offline page as String.
sw-runtime.js (service worker JavaScript for precaching runtime generated resources) as a String.
-
Constructor Details
-
PwaRegistry
Creates a new PwaRegistry instance.
Parameters:
pwa
- the pwa annotationservletContext
- the contextThrows:
IOException
- when icon or offline resources are not found.
-
-
Method Details
-
getInstance
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
Static offline page as String.
Returns:
contents of offline page
-
getManifestJson
manifest.webmanifest contents as a String.
Returns:
contents of manifest.webmanifest
-
getRuntimeServiceWorkerJs
sw-runtime.js (service worker JavaScript for precaching runtime generated resources) as a String.
Returns:
contents of sw-runtime.js
-
getHeaderIcons
List of
PwaIcon
:s that should be added to header.Returns:
List of
PwaIcon
:s that should be added to header -
getManifestIcons
List of
PwaIcon
:s that should be added to manifest.webmanifest.Returns:
List of
PwaIcon
:s that should be added to manifest.webmanifest -
getIcons
List of all icons managed by
PwaRegistry
.Returns:
List of all icons managed by
PwaRegistry
-
getPwaConfiguration
-
getIconTemplates
Gets all PWA icon variants for the give base icon.
Parameters:
baseName
- path of the base icon.Returns:
list of PWA icons variants.
-