diff --git a/README.md b/README.md
index e35c547..0a13ae3 100644
--- a/README.md
+++ b/README.md
@@ -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.
+
diff --git a/frontend/example-template.js b/frontend/example-template.js
new file mode 100644
index 0000000..bf65305
--- /dev/null
+++ b/frontend/example-template.js
@@ -0,0 +1,13 @@
+import { html, PolymerElement } from '@polymer/polymer';
+
+export class ExampleTemplate extends PolymerElement {
+ static get is() {
+ return 'example-template'
+ }
+
+ static get template() {
+ return html`[[message]]`;
+ }
+}
+
+customElements.define(ExampleTemplate.is, ExampleTemplate);
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9f4e071..bd65aba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,8 +18,7 @@
src/main/webapp
- 10.0.3
- 1.0.3
+ 14.8.14
@@ -56,12 +55,11 @@
com.vaadin
vaadin-cdi
- 10.0.0.beta1
javax
javaee-api
- 7.0
+ 8.0
provided
@@ -74,6 +72,30 @@
+
+ com.vaadin
+ vaadin-maven-plugin
+ ${vaadin.version}
+
+ true
+ true
+
+
+
+
+ prepare-frontend
+
+
+
+
+
+ org.wildfly.plugins
+ wildfly-maven-plugin
+ 2.0.0.Final
+
+ 15.0.0.Final
+
+
org.apache.tomee.maven
tomee-maven-plugin
@@ -121,18 +143,12 @@
com.vaadin
- flow-maven-plugin
- ${flow.maven.plugin.version}
+ vaadin-maven-plugin
- prepare-package
- copy-production-files
- package-for-production
+ build-frontend
-
- ${webapp.directory}
-
diff --git a/src/main/java/org/vaadin/cdi/tutorial/ExampleTemplate.java b/src/main/java/org/vaadin/cdi/tutorial/ExampleTemplate.java
index f45cdd7..710a1cb 100644
--- a/src/main/java/org/vaadin/cdi/tutorial/ExampleTemplate.java
+++ b/src/main/java/org/vaadin/cdi/tutorial/ExampleTemplate.java
@@ -16,7 +16,7 @@
package org.vaadin.cdi.tutorial;
import com.vaadin.flow.component.Tag;
-import com.vaadin.flow.component.dependency.HtmlImport;
+import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.polymertemplate.PolymerTemplate;
import com.vaadin.flow.templatemodel.TemplateModel;
import org.vaadin.cdi.tutorial.ExampleTemplate.ExampleModel;
@@ -27,14 +27,13 @@
* Simple template example.
*/
@Tag("example-template")
-@HtmlImport("frontend://ExampleTemplate.html")
+@JsModule("./example-template.js")
public class ExampleTemplate extends PolymerTemplate {
/**
* Template model which defines the single "name" property.
*/
public interface ExampleModel extends TemplateModel {
-
void setMessage(String message);
}
diff --git a/src/main/java/org/vaadin/cdi/tutorial/MyServlet.java b/src/main/java/org/vaadin/cdi/tutorial/MyServlet.java
new file mode 100644
index 0000000..2824b3c
--- /dev/null
+++ b/src/main/java/org/vaadin/cdi/tutorial/MyServlet.java
@@ -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 klicken Sie hier oder drücken Sie die ESC-Taste...");
+ messages.setSessionExpiredNotificationEnabled(true);
+ messages.setInternalErrorCaption("Kommunikationsfehler");
+ messages.setInternalErrorMessage("Bitte notieren Sie ungespeicherte Daten und klicken Sie hier 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.
Bitte schalten Sie Cookies in Ihrem Browser ein und klicken Sie hier oder drücken Sie die ESC-Taste...");
+ messages.setCookiesDisabledNotificationEnabled(true);
+ messages.setInternalErrorCaption("Interner Fehler");
+ messages.setInternalErrorMessage("Informieren Sie Ihren Anwendungsbetreuer.
Bitte notieren Sie ungespeicherte Daten und klicken Sie hier oder drücken Sie die ESC-Taste...");
+ messages.setInternalErrorNotificationEnabled(true);
+ return messages;
+ }
+ });
+ }
+}
diff --git a/src/main/java/org/vaadin/cdi/tutorial/RootComponent.java b/src/main/java/org/vaadin/cdi/tutorial/RootComponent.java
index 5f5babf..324e2ee 100644
--- a/src/main/java/org/vaadin/cdi/tutorial/RootComponent.java
+++ b/src/main/java/org/vaadin/cdi/tutorial/RootComponent.java
@@ -46,12 +46,11 @@ public RootComponent(UiGreeter uiGreeter, ExampleTemplate template) {
getTranslation("root.navigate_to_component"),
ParentView.class);
- Style linkStyle = link.getElement().getStyle();
+ Style linkStyle = link.getStyle();
linkStyle.set("display", "block");
linkStyle.set("margin-bottom", "10px");
add(greeting, button, link, template);
- add(template);
}
@Override
diff --git a/src/main/webapp/frontend/ExampleTemplate.html b/src/main/webapp/frontend/ExampleTemplate.html
deleted file mode 100644
index 7f3be4a..0000000
--- a/src/main/webapp/frontend/ExampleTemplate.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
- [[message]]
-
-
-
-
-