changeset 4554:d961bb99a5c2

Merged
author Christian Lins <christian.lins@intevation.de>
date Fri, 16 Nov 2012 12:37:04 +0100
parents ea40a5ded134 (diff) fac54b8470d4 (current diff)
children 0441f62535af
files
diffstat 6 files changed, 36 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java	Fri Nov 16 12:37:04 2012 +0100
@@ -1,7 +1,6 @@
 package de.intevation.flys.artifacts.model.minfo;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -9,7 +8,6 @@
 import java.util.Set;
 
 import org.apache.log4j.Logger;
-import org.jfree.util.Log;
 
 
 public class SedimentDensity
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java	Fri Nov 16 12:37:04 2012 +0100
@@ -4,8 +4,6 @@
 import java.util.HashMap;
 import java.util.Set;
 
-import org.apache.log4j.Logger;
-
 import de.intevation.flys.artifacts.model.NamedObjectImpl;
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java	Fri Nov 16 12:37:04 2012 +0100
@@ -2,7 +2,6 @@
 
 import gnu.trove.TDoubleArrayList;
 
-import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -13,7 +12,6 @@
 import org.apache.log4j.Logger;
 import org.hibernate.SQLQuery;
 import org.hibernate.Session;
-import org.hibernate.exception.SQLGrammarException;
 import org.hibernate.type.StandardBasicTypes;
 
 import de.intevation.flys.artifacts.cache.CacheFactory;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/process/BedheightProcessor.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/process/BedheightProcessor.java	Fri Nov 16 12:37:04 2012 +0100
@@ -2,8 +2,6 @@
 
 import java.util.List;
 
-import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
-
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
 import org.w3c.dom.Document;
@@ -23,8 +21,13 @@
     private final static String BEDHEIGHT = "bedheight";
 
     @Override
-    public void doOut(XYChartGenerator generator, ArtifactAndFacet aandf,
-            Document theme, boolean visible, int index) {
+    public void doOut(
+            XYChartGenerator generator,
+            ArtifactAndFacet aandf,
+            Document theme,
+            boolean visible,
+            int index
+    ) {
         CallContext context = generator.getCallContext();
         Object data = aandf.getData(context);
         if (data instanceof BedHeightSingle) {
@@ -73,5 +76,4 @@
 
         generator.addAxisSeries(series, index, visible);
     }
-
 }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java	Fri Nov 16 12:37:04 2012 +0100
@@ -5,7 +5,6 @@
 
 import java.math.BigDecimal;
 
-import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java	Fri Nov 16 12:36:10 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java	Fri Nov 16 12:37:04 2012 +0100
@@ -7,6 +7,8 @@
 import de.intevation.flys.client.server.features.Features;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Enumeration;
 
 import javax.servlet.Filter;
@@ -34,11 +36,9 @@
     private String redirecturl;
     private ServletContext sc;
 
-    public static final String LOGIN_JSP     = "/login.jsp";
-    public static final String LOGIN_SERVLET = "/flys/login";
-    public static final String FLYS_CSS      = "/FLYS.css";
-    public static final String MAP_PRINT     = "/flys/map-print";
-    public static final String MAPFISH_PRINT = "/flys/mapfish-print/print.pdf";
+    private static final String LOGIN_JSP     = "/login.jsp";
+    private static final String LOGIN_SERVLET = "/flys/login";
+    private static final String FLYS_CSS      = "/FLYS.css";
 
 
     /**
@@ -87,14 +87,18 @@
 
         logger.debug("Request for: " + requesturi);
 
+        // Allow acces to localhost
+        if (isLocalAddress(req)) {
+            logger.debug("Request to localhost");
+            chain.doFilter(req, resp);
+            return;
+        }
+
         // Allow access to login pages
-        // TODO Maybe replace with Filter <url-pattern>
         String path = this.sc.getContextPath();
         if (requesturi.equals(path + LOGIN_JSP)
                 || requesturi.equals(path + LOGIN_SERVLET)
-                || requesturi.equals(path + FLYS_CSS)
-                || requesturi.equals(path + MAP_PRINT)
-                || requesturi.equals(path + MAPFISH_PRINT)) {
+                || requesturi.equals(path + FLYS_CSS)) {
             logger.debug("Request for login " + requesturi);
             chain.doFilter(req, resp);
             return;
@@ -178,5 +182,21 @@
         return AuthenticationFactory.getInstance(this.authmethod).auth(
                 user.getName(), user.getPassword(), encoding, features);
     }
+
+    /**
+     * Returns true if the request is from our machine
+     * @param req The ServletRequest
+     * @return true if the request is from a loopback interface or from one of
+     *  the interface addresses of the machine
+     */
+    private boolean isLocalAddress(ServletRequest req) {
+        try {
+            InetAddress addr = InetAddress.getByName(req.getRemoteAddr());
+            return addr.isAnyLocalAddress() || addr.isLoopbackAddress();
+        } catch (UnknownHostException e) {
+            logger.error(e, e);
+            return false;
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org