Creating PWAs with Vaadin

The Vaadin server automatically serves the needed resources for a PWA, when you use the @PWA annotation in the root layout of your application.

Example: Using the @PWA annotation with the @Route annotation to automatically serve PWA resources.

Java

  1. @PWA(name = "My Progressive Web Application",
  2. shortName = "MyPWA")
  3. @Route("")
  4. public class MyPWA extends Div {
  5. public MyPWA() {
  6. setText("Welcome to my PWA");
  7. }
  8. }
Note
You can only have one @PWA annotation per application. The annotation must be placed in the application’s parent layout, or in a view annotated with @Route.