Skip to content
This repository was archived by the owner on May 5, 2022. It is now read-only.

Making the demo app more upto date #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ The topics that are covered in this tutorial project:
* Register VaadinServiceInitListener via CDI Observer
* Flow template within CDI
* Use I18N in CDI
* Extending servlet

## Running the project from command line

Run `mvn clean package tomee:run` in the project root directory. After the server has started point your browser to [http://localhost:8080](http://localhost:8080) to see the resulting application.

or

Run ``mvn clean package wildfly:run` in the project root directory. After the server has started point your browser to [http://localhost:8080/cdi.tutorial-1.0.0-SNAPSHOT/](http://localhost:8080/cdi.tutorial-1.0.0-SNAPSHOT/) to see the resulting application.

15 changes: 13 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<webapp.directory>src/main/webapp</webapp.directory>

<!-- Dependencies -->
<vaadin.version>10.0.3</vaadin.version>
<vaadin.version>14.0.9</vaadin.version>
<flow.maven.plugin.version>1.0.3</flow.maven.plugin.version>
</properties>

Expand Down Expand Up @@ -53,10 +53,13 @@
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-compatibility-mode</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-cdi</artifactId>
<version>10.0.0.beta1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
Expand All @@ -74,6 +77,14 @@

<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>2.0.0.Final</version>
<configuration>
<version>15.0.0.Final</version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/org/vaadin/cdi/tutorial/MyServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.vaadin.cdi.tutorial;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;

import com.vaadin.cdi.CdiVaadinServlet;
import com.vaadin.flow.server.CustomizedSystemMessages;
import com.vaadin.flow.server.SystemMessages;
import com.vaadin.flow.server.SystemMessagesInfo;
import com.vaadin.flow.server.SystemMessagesProvider;

@WebServlet(urlPatterns = {"/*","/frontend/*"}, asyncSupported = true)
public class MyServlet extends CdiVaadinServlet {

@Override
protected void servletInitialized() throws ServletException
{
super.servletInitialized();

this.getService().setSystemMessagesProvider(new SystemMessagesProvider() {

@Override
public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
CustomizedSystemMessages messages = new CustomizedSystemMessages();
messages.setSessionExpiredCaption("Sitzung abgelaufen");
messages.setSessionExpiredMessage("Bitte notieren Sie ungespeicherte Daten und <u>klicken Sie hier</u> oder drücken Sie die ESC-Taste...");
messages.setSessionExpiredNotificationEnabled(true);
messages.setInternalErrorCaption("Kommunikationsfehler");
messages.setInternalErrorMessage("Bitte notieren Sie ungespeicherte Daten und <u>klicken Sie hier</u> oder drücken Sie die ESC-Taste...");
messages.setInternalErrorNotificationEnabled(true);
messages.setCookiesDisabledCaption("Cookies sind abgeschaltet");
messages.setCookiesDisabledMessage("Diese Anwendung benötigt Cookies, um korrekt zu funktionieren.<br>Bitte schalten Sie Cookies in Ihrem Browser ein und <u>klicken Sie hier</u> oder drücken Sie die ESC-Taste...");
messages.setCookiesDisabledNotificationEnabled(true);
messages.setInternalErrorCaption("Interner Fehler");
messages.setInternalErrorMessage("Informieren Sie Ihren Anwendungsbetreuer.<br/>Bitte notieren Sie ungespeicherte Daten und <u>klicken Sie hier</u> oder drücken Sie die ESC-Taste...");
messages.setInternalErrorNotificationEnabled(true);
return messages;
}
});
}
}