Package com.vaadin.flow.server
Class PwaConfiguration
java.lang.Object
com.vaadin.flow.server.PwaConfiguration
- All Implemented Interfaces:
Serializable
Holds the configuration from the
PWA
annotation.
Takes PWA
in constructor to fill properties. Sanitizes the input and
falls back to default values if PWA
is unavailable (null
).- Since:
- 1.2
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates the configuration using default PWA parameters.PwaConfiguration
(boolean enabled, String name, String shortName, String description, String backgroundColor, String themeColor, String iconPath, String manifestPath, String offlinePath, String display, String startPath, String[] offlineResources, boolean offlineEnabled) Constructs a configuration from individual values.PwaConfiguration
(PWA pwa) Constructs the configuration using thePWA
annotation. -
Method Summary
Modifier and TypeMethodDescriptionGets the application name.Gets the background color of the application.Gets the application description.Gets the the developers? preferred display mode for the website.Gets the path to the application icon file.Gets the path to the manifest.webmanifest.Path to static offline html file.Gets the list of files to be added to pre cache.Gets the path to the service worker.Gets the application short name.Gets the start url of the PWA application.Gets the theme color of the application.boolean
Is PWA enabled.boolean
Is offline enabled.boolean
Is static offline HTML used for offline mode.Gets the ath to icon with prefix, so request matches.Path to manifest with prefix, so request matches.Path to offline file with prefix, so request matches.Gets the path to service worker with prefix, so request matches.
-
Field Details
-
DEFAULT_PATH
- See Also:
-
DEFAULT_ICON
- See Also:
-
DEFAULT_NAME
- See Also:
-
DEFAULT_THEME_COLOR
- See Also:
-
DEFAULT_BACKGROUND_COLOR
- See Also:
-
DEFAULT_DISPLAY
- See Also:
-
DEFAULT_OFFLINE_PATH
- See Also:
-
DEFAULT_START_URL
- See Also:
-
-
Constructor Details
-
PwaConfiguration
public PwaConfiguration()Creates the configuration using default PWA parameters. -
PwaConfiguration
Constructs the configuration using thePWA
annotation.- Parameters:
pwa
- the annotation to use for configuration
-
PwaConfiguration
public PwaConfiguration(boolean enabled, String name, String shortName, String description, String backgroundColor, String themeColor, String iconPath, String manifestPath, String offlinePath, String display, String startPath, String[] offlineResources, boolean offlineEnabled) Constructs a configuration from individual values.- Parameters:
enabled
- is PWA enabledname
- the application nameshortName
- the application short namedescription
- the description of the applicationbackgroundColor
- the background colorthemeColor
- the theme coloriconPath
- the icon file pathmanifestPath
- the `manifest.webmanifest` file pathofflinePath
- the static offline HTML file pathdisplay
- the display modestartPath
- the start pathofflineResources
- the list of files to add for pre-cachingofflineEnabled
- is offline enabled.
-
-
Method Details
-
getAppName
Gets the application name.- Returns:
- application name
-
getShortName
Gets the application short name. Max 12 characters.- Returns:
- application short name
-
getDescription
Gets the application description.- Returns:
- application description
-
getBackgroundColor
Gets the background color of the application. The background color property is used on the splash screen when the application is first launched.- Returns:
- background color of the application
-
getThemeColor
Gets the theme color of the application. The theme color sets the color of the application's tool bar and application's color in the task switcher.- Returns:
- theme color of the application
-
getIconPath
Gets the path to the application icon file.Example: img/my-icon.png
- Returns:
- path to the application icon file
-
relIconPath
Gets the ath to icon with prefix, so request matches.- Returns:
- path to icon with prefix, so request matches
-
getManifestPath
Gets the path to the manifest.webmanifest.- Returns:
- path to the manifest.webmanifest
-
relManifestPath
Path to manifest with prefix, so request matches.- Returns:
- path to manifest with prefix, so request matches
-
getOfflinePath
Path to static offline html file.- Returns:
- path to static offline html file
-
relOfflinePath
Path to offline file with prefix, so request matches.- Returns:
- path to offline file with prefix, so request matches
-
getServiceWorkerPath
Gets the path to the service worker.- Returns:
- path to service worker
-
relServiceWorkerPath
Gets the path to service worker with prefix, so request matches.- Returns:
- path to service worker with prefix, so request matches
-
getOfflineResources
Gets the list of files to be added to pre cache.- Returns:
- list of files to be added to pre cache
-
isOfflineEnabled
public boolean isOfflineEnabled()Is offline enabled.- Returns:
- is offline enabled.
-
getDisplay
Gets the the developers? preferred display mode for the website. Possible values: fullscreen, standalone, minimal-ui, browser- Returns:
- display mode
-
getStartUrl
Gets the start url of the PWA application.Used in manifest as start url.
- Returns:
- start url of the PWA application
-
isEnabled
public boolean isEnabled()Is PWA enabled.- Returns:
- is PWA enabled
-
isOfflinePathEnabled
public boolean isOfflinePathEnabled()Is static offline HTML used for offline mode. Disabled by default, meaning that application shell (`index.html`) and client-side views are served offline. SetPWA.offlinePath()
value in PWA annotation to enable.- Returns:
- true when static offline HTML is used
-