changeset 3491:1c9bfdbfb265

Add new RemoteServiceServlet class Implement an extended GWT RemoteServiceServlet to be able to get the current logged in user easily. This class can be used as a base class for all flys RemoteServices if the current user and the allowed features have to be evaluated. flys-client/trunk@5207 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Wed, 15 Aug 2012 12:08:20 +0000
parents 5f628a13ca9f
children d45fcf70b994
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Aug 13 07:58:47 2012 +0000
+++ b/flys-client/ChangeLog	Wed Aug 15 12:08:20 2012 +0000
@@ -1,3 +1,8 @@
+2012-08-15	Björn Ricks <bjoern.ricks@intevation.de>
+	* src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java:
+	  Implement an extended GWT RemoteServiceServlet to be able to get the
+	  current logged in user easily.
+
 2012-08-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java	Wed Aug 15 12:08:20 2012 +0000
@@ -0,0 +1,17 @@
+package de.intevation.flys.client.server;
+
+import javax.servlet.http.HttpSession;
+
+import de.intevation.flys.client.server.auth.User;
+
+public class RemoteServiceServlet
+extends      com.google.gwt.user.server.rpc.RemoteServiceServlet
+{
+    /**
+     * Return the current logged in user from the HTTP Session
+    */
+    public User getUser() {
+        HttpSession session = this.getThreadLocalRequest().getSession();
+        return (User)session.getAttribute("user");
+    }
+}

http://dive4elements.wald.intevation.org