summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/vaadin/build.xml1
-rw-r--r--java/vaadin/src/main/WebContent/WEB-INF/web.xml28
-rw-r--r--java/vaadin/src/main/java/ch/asynk/HelloWorld.java2
-rw-r--r--java/vaadin/src/main/java/ch/asynk/HelloWorldServlet.java37
4 files changed, 47 insertions, 21 deletions
diff --git a/java/vaadin/build.xml b/java/vaadin/build.xml
index b1ee9f4..f7024ce 100644
--- a/java/vaadin/build.xml
+++ b/java/vaadin/build.xml
@@ -97,6 +97,7 @@
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
includeantruntime="false">
+ <classpath refid="cp.tomcat"/>
<classpath refid="ivy.deps.server-side"/>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-path"/>
diff --git a/java/vaadin/src/main/WebContent/WEB-INF/web.xml b/java/vaadin/src/main/WebContent/WEB-INF/web.xml
index f4b7f85..6e03c3d 100644
--- a/java/vaadin/src/main/WebContent/WEB-INF/web.xml
+++ b/java/vaadin/src/main/WebContent/WEB-INF/web.xml
@@ -19,27 +19,13 @@
<!-- <tracking-mode>COOKIE</tracking-mode> -->
</session-config>
- <servlet>
- <servlet-name>default</servlet-name>
- <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
- <init-param>
- <description>Vaadin application class to start</description>
- <param-name>UI</param-name>
- <param-value>ch.asynk.HelloWorld</param-value>
- </init-param>
- <async-supported>true</async-supported>
- </servlet>
- <servlet-mapping>
- <servlet-name>default</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
<!-- <welcome-file-list> -->
- <!-- <welcome-file>index.html</welcome-file> -->
- <!-- <welcome-file>index.htm</welcome-file> -->
- <!-- <welcome-file>index.jsp</welcome-file> -->
- <!-- <welcome-file>default.html</welcome-file> -->
- <!-- <welcome-file>default.htm</welcome-file> -->
- <!-- <welcome-file>default.jsp</welcome-file> -->
- <!-- </welcome-file-list> -->
+ <!-- <welcome-file>index.html</welcome-file> -->
+ <!-- <welcome-file>index.htm</welcome-file> -->
+ <!-- <welcome-file>index.jsp</welcome-file> -->
+ <!-- <welcome-file>default.html</welcome-file> -->
+ <!-- <welcome-file>default.htm</welcome-file> -->
+ <!-- <welcome-file>default.jsp</welcome-file> -->
+ <!-- </welcome-file-list> -->
</web-app>
diff --git a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java
index f15bddd..c9f807e 100644
--- a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java
+++ b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java
@@ -1,5 +1,6 @@
package ch.asynk;
+import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.server.VaadinRequest;
@@ -15,6 +16,7 @@ import com.vaadin.ui.VerticalLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@PreserveOnRefresh
@Title("Hello!!")
@Theme("mytheme")
public class HelloWorld extends UI
diff --git a/java/vaadin/src/main/java/ch/asynk/HelloWorldServlet.java b/java/vaadin/src/main/java/ch/asynk/HelloWorldServlet.java
new file mode 100644
index 0000000..e4092f2
--- /dev/null
+++ b/java/vaadin/src/main/java/ch/asynk/HelloWorldServlet.java
@@ -0,0 +1,37 @@
+package ch.asynk;
+
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.ServletException;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.SessionInitEvent;
+import com.vaadin.server.SessionInitListener;
+import com.vaadin.server.SessionDestroyEvent;
+import com.vaadin.server.SessionDestroyListener;
+import com.vaadin.server.VaadinServlet;
+
+@WebServlet(value = "/*", asyncSupported = true)
+@VaadinServletConfiguration(productionMode = false, ui = ch.asynk.HelloWorld.class, closeIdleSessions = true)
+public class HelloWorldServlet extends VaadinServlet implements SessionInitListener, SessionDestroyListener
+{
+ private static final long serialVersionUID = 511085337415583793L;
+ @Override
+ protected void servletInitialized() throws ServletException {
+ super.servletInitialized();
+ getService().addSessionInitListener(this);
+ getService().addSessionDestroyListener(this);
+ }
+
+ @Override
+ public void sessionInit(SessionInitEvent event) throws ServiceException
+ {
+ event.getSession().setLocale(new java.util.Locale("fr", "CH"));
+ System.err.println("sessionInit");
+ }
+
+ @Override
+ public void sessionDestroy(SessionDestroyEvent event) {
+ System.err.println("sessionDestroy");
+ }
+}