summaryrefslogtreecommitdiffstats
path: root/server/src/com
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-06 16:51:47 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-06 17:07:49 +0300
commita64b703b2bd714f8ff1c6cfd1b8b89908e502691 (patch)
treedd00d0f2477a691ca2e0674ed14ef05f221e5125 /server/src/com
parentcf31c3c750e699c09a045a9e740bb4daf2c90a75 (diff)
downloadvaadin-framework-a64b703b2bd714f8ff1c6cfd1b8b89908e502691.tar.gz
vaadin-framework-a64b703b2bd714f8ff1c6cfd1b8b89908e502691.zip
Add VaadinSession getter to VaadinService (#9402)
Diffstat (limited to 'server/src/com')
-rw-r--r--server/src/com/vaadin/server/AbstractVaadinService.java7
-rw-r--r--server/src/com/vaadin/server/VaadinPortlet.java1
-rw-r--r--server/src/com/vaadin/server/VaadinService.java14
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java1
4 files changed, 23 insertions, 0 deletions
diff --git a/server/src/com/vaadin/server/AbstractVaadinService.java b/server/src/com/vaadin/server/AbstractVaadinService.java
index dc6342b299..6e14c1984b 100644
--- a/server/src/com/vaadin/server/AbstractVaadinService.java
+++ b/server/src/com/vaadin/server/AbstractVaadinService.java
@@ -76,4 +76,11 @@ public abstract class AbstractVaadinService implements VaadinService {
public AddonContext getAddonContext() {
return addonContext;
}
+
+ @Override
+ public VaadinSession getVaadinSession(WrappedRequest request) {
+ return (VaadinSession) request.getAttribute(VaadinSession.class
+ .getName());
+ }
+
}
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java
index af59a09c82..4bd68bde66 100644
--- a/server/src/com/vaadin/server/VaadinPortlet.java
+++ b/server/src/com/vaadin/server/VaadinPortlet.java
@@ -462,6 +462,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
return;
}
VaadinSession.setCurrent(application);
+ request.setAttribute(VaadinSession.class.getName(), application);
/*
* Get or create an application context and an application
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index 1e9a2667c3..827902def2 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -138,4 +138,18 @@ public interface VaadinService extends Serializable {
* base directory.
*/
public File getBaseDirectory();
+
+ /**
+ * Gets the Vaadin session associated with this request.
+ *
+ * @param request
+ * the request to get a vaadin session for.
+ *
+ * @see VaadinSession
+ *
+ * @return the vaadin session for the request, or <code>null</code> if no
+ * session is found and this is a request for which a new session
+ * shouldn't be created.
+ */
+ public VaadinSession getVaadinSession(WrappedRequest request);
}
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index e7e5dfe7d8..cbf5765658 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -306,6 +306,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
if (application == null) {
return;
}
+ request.setAttribute(VaadinSession.class.getName(), application);
VaadinSession.setCurrent(application);
/*