Package com.vaadin.flow.server
Class PwaConfiguration
- java.lang.Object
-
- com.vaadin.flow.server.PwaConfiguration
-
- All Implemented Interfaces:
Serializable
public class PwaConfiguration extends Object implements Serializable
Holds the configuration from thePWA
annotation. TakesPWA
in constructor to fill properties. Sanitizes the input and falls back to default values ifPWA
is unavailable (null
).- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_BACKGROUND_COLOR
static String
DEFAULT_DISPLAY
static String
DEFAULT_ICON
static String
DEFAULT_NAME
static String
DEFAULT_OFFLINE_PATH
static String
DEFAULT_PATH
static String
DEFAULT_START_URL
static String
DEFAULT_THEME_COLOR
-
Constructor Summary
Constructors Constructor Description PwaConfiguration()
Default constructor, uses default values.PwaConfiguration(boolean useV14Bootstrap)
Creates 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(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, boolean useV14Bootstrap)
Constructs a configuration from individual values.PwaConfiguration(PWA pwa)
Constructs the configuration using thePWA
annotation.PwaConfiguration(PWA pwa, boolean useV14Bootstrap)
Constructs the configuration using thePWA
annotation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAppName()
Gets the application name.String
getBackgroundColor()
Gets the background color of the application.String
getDescription()
Gets the application description.String
getDisplay()
Gets the the developers? preferred display mode for the website.String
getIconPath()
Gets the path to the application icon file.String
getManifestPath()
Gets the path to the manifest.webmanifest.String
getOfflinePath()
Path to static offline html file.List<String>
getOfflineResources()
Gets the list of files to be added to pre cache.String
getServiceWorkerPath()
Gets the path to the service worker.String
getShortName()
Gets the application short name.String
getStartUrl()
Gets the start url of the PWA application.String
getThemeColor()
Gets the theme color of the application.boolean
isEnabled()
Is PWA enabled.boolean
isOfflineEnabled()
Is offline enabled.boolean
isOfflinePathEnabled()
Is static offline HTML used for offline mode.String
relIconPath()
Gets the ath to icon with prefix, so request matches.String
relManifestPath()
Path to manifest with prefix, so request matches.String
relOfflinePath()
Path to offline file with prefix, so request matches.String
relServiceWorkerPath()
Gets the path to service worker with prefix, so request matches.
-
-
-
Field Detail
-
DEFAULT_PATH
public static final String DEFAULT_PATH
- See Also:
- Constant Field Values
-
DEFAULT_ICON
public static final String DEFAULT_ICON
- See Also:
- Constant Field Values
-
DEFAULT_NAME
public static final String DEFAULT_NAME
- See Also:
- Constant Field Values
-
DEFAULT_THEME_COLOR
public static final String DEFAULT_THEME_COLOR
- See Also:
- Constant Field Values
-
DEFAULT_BACKGROUND_COLOR
public static final String DEFAULT_BACKGROUND_COLOR
- See Also:
- Constant Field Values
-
DEFAULT_DISPLAY
public static final String DEFAULT_DISPLAY
- See Also:
- Constant Field Values
-
DEFAULT_OFFLINE_PATH
public static final String DEFAULT_OFFLINE_PATH
- See Also:
- Constant Field Values
-
DEFAULT_START_URL
public static final String DEFAULT_START_URL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PwaConfiguration
public PwaConfiguration()
Default constructor, uses default values.
-
PwaConfiguration
public PwaConfiguration(boolean useV14Bootstrap)
Creates the configuration using default PWA parameters.- Parameters:
useV14Bootstrap
- true iff using legacy bootstrap mode
-
PwaConfiguration
public PwaConfiguration(PWA pwa)
Constructs the configuration using thePWA
annotation.- Parameters:
pwa
- the annotation to use for configuration
-
PwaConfiguration
public PwaConfiguration(PWA pwa, boolean useV14Bootstrap)
Constructs the configuration using thePWA
annotation.- Parameters:
pwa
- the annotation to use for configurationuseV14Bootstrap
- true iff using legacy bootstrap mode
-
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
-
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, boolean useV14Bootstrap)
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.useV14Bootstrap
- true iff using legacy bootstrap mode
-
-
Method Detail
-
getAppName
public String getAppName()
Gets the application name.- Returns:
- application name
-
getShortName
public String getShortName()
Gets the application short name. Max 12 characters.- Returns:
- application short name
-
getDescription
public String getDescription()
Gets the application description.- Returns:
- application description
-
getBackgroundColor
public String 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
public String 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
public String getIconPath()
Gets the path to the application icon file.Example: img/my-icon.png
- Returns:
- path to the application icon file
-
relIconPath
public String relIconPath()
Gets the ath to icon with prefix, so request matches.- Returns:
- path to icon with prefix, so request matches
-
getManifestPath
public String getManifestPath()
Gets the path to the manifest.webmanifest.- Returns:
- path to the manifest.webmanifest
-
relManifestPath
public String relManifestPath()
Path to manifest with prefix, so request matches.- Returns:
- path to manifest with prefix, so request matches
-
getOfflinePath
public String getOfflinePath()
Path to static offline html file.- Returns:
- path to static offline html file
-
relOfflinePath
public String relOfflinePath()
Path to offline file with prefix, so request matches.- Returns:
- path to offline file with prefix, so request matches
-
getServiceWorkerPath
public String getServiceWorkerPath()
Gets the path to the service worker.- Returns:
- path to service worker
-
relServiceWorkerPath
public String relServiceWorkerPath()
Gets the path to service worker with prefix, so request matches.- Returns:
- path to service worker with prefix, so request matches
-
getOfflineResources
public List<String> 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
public String getDisplay()
Gets the the developers? preferred display mode for the website. Possible values: fullscreen, standalone, minimal-ui, browser- Returns:
- display mode
-
getStartUrl
public String 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
-
-