[Webflysuesk-commits] r43 - in webflysuesk/branches/openlayers-integration: . webflys/src/main/java/de/intevation/webflys/servlets webflys/src/main/webapp/WEB-INF
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 30 14:58:53 CEST 2009
Author: iweinzierl
Date: 2009-03-30 14:58:44 +0200 (Mon, 30 Mar 2009)
New Revision: 43
Added:
webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java
webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/UserId.java
Modified:
webflysuesk/branches/openlayers-integration/ChangeLog.txt
webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/WEB-INF/web.xml
Log:
New services to get information about the user, registered to the session, and the river we are working with.
Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-03-27 15:42:31 UTC (rev 42)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-03-30 12:58:44 UTC (rev 43)
@@ -1,3 +1,11 @@
+2009-03-30 Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
+ * webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java,
+ webflys/src/main/java/de/intevation/webflys/servlets/UserId.java,
+ webflys/src/main/webapp/WEB-INF/web.xml: New services.
+ 'webflys/userId' tells us which user is registered to the session.
+ 'webflys/getGewaesser' tells us which river we are working with.
+
2009-03-27 Ingo Weinzierl <ingo.weinzierl at intevation.de>
New Feature: Now we can draw lines into the map.
Added: webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java 2009-03-27 15:42:31 UTC (rev 42)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java 2009-03-30 12:58:44 UTC (rev 43)
@@ -0,0 +1,78 @@
+/*
+ * GetGewaesser.java
+ * -------------
+ * (c) 2009 by Intevation GmbH
+ *
+ * This file is part of WebFLYS/UeSK.
+ *
+ * WebFLYS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * WebFLYS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with WebFLYS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.intevation.webflys.servlets;
+
+/**
+ * HttpServlet to get information about the river registered in the session.
+ *
+ * @author Ingo Weinzierl <ingo.weinzierl at intevation.de>
+ */
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpSession;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
+
+import de.intevation.webflys.model.Parameters;
+import de.intevation.webflys.model.Rivers;
+import de.intevation.webflys.model.River;
+
+public class GetGewaesser extends HttpServlet {
+
+ public static final String MIME_TYPE = "text/xml";
+ public static final String RIVER_PARAM = "river";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ ServletOutputStream out = response.getOutputStream();
+ HttpSession session = request.getSession();
+ ServletContext sc = getServletContext();
+ response.setContentType(MIME_TYPE);
+
+ // fetch the river from request
+ String river_session = request.getParameter(RIVER_PARAM);
+
+ // if no river name was sent in the request, fetch river from session
+ if( river_session == null ) {
+ Parameters parameters =
+ (Parameters)session.getAttribute("parameters");
+
+ river_session = parameters.getRiver();
+ }
+
+ // if no river
+ if(river_session == null) {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ // return the boundingbox of the given river in the ServletContext
+ else
+ out.println("<gewaesser>" + river_session + "</gewaesser>");
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
Added: webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/UserId.java
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/UserId.java 2009-03-27 15:42:31 UTC (rev 42)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/java/de/intevation/webflys/servlets/UserId.java 2009-03-30 12:58:44 UTC (rev 43)
@@ -0,0 +1,67 @@
+/*
+ * GetUserId.java
+ * -------------
+ * (c) 2009 by Intevation GmbH
+ *
+ * This file is part of WebFLYS/UeSK.
+ *
+ * WebFLYS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * WebFLYS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with WebFLYS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.intevation.webflys.servlets;
+
+/**
+ * HttpServlet to get information about user registered in the session.
+ *
+ * @author Ingo Weinzierl <ingo.weinzierl at intevation.de>
+ */
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpSession;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
+
+import de.intevation.webflys.model.Parameters;
+import de.intevation.webflys.model.User;
+
+public class UserId extends HttpServlet {
+
+ public static final String MIME_TYPE = "text/xml";
+ public static final String USER_ID = "user";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ ServletOutputStream out = response.getOutputStream();
+ HttpSession session = request.getSession();
+ response.setContentType(MIME_TYPE);
+
+ User user = (User)session.getAttribute(USER_ID);
+
+ // if no user is registered, return an error
+ if( user == null ) {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ // return the userid
+ else
+ out.println("<user-name>" + user.getName() + "</user-name>");
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/WEB-INF/web.xml
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/WEB-INF/web.xml 2009-03-27 15:42:31 UTC (rev 42)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/WEB-INF/web.xml 2009-03-30 12:58:44 UTC (rev 43)
@@ -37,7 +37,28 @@
<url-pattern>/bbox</url-pattern>
</servlet-mapping>
+ <servlet>
+ <servlet-name>userId</servlet-name>
+ <servlet-class>de.intevation.webflys.servlets.UserId</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>userId</servlet-name>
+ <url-pattern>/userId</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>getGewaesser</servlet-name>
+ <servlet-class>de.intevation.webflys.servlets.GetGewaesser</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>getGewaesser</servlet-name>
+ <url-pattern>/getGewaesser</url-pattern>
+ </servlet-mapping>
+
+
+
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>de.intevation.webflys.filters.EncodingFilter</filter-class>
More information about the Webflysuesk-commits
mailing list