changeset 1024:b45faa9315ce

Addition to the last revision: MapViewer calls via HTTP Post are also logged (#323). gnv/trunk@1278 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Nov 2010 10:48:30 +0000
parents e887763a37e2
children 2996395e44c9
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Fri Nov 26 10:04:22 2010 +0000
+++ b/gnv/ChangeLog	Fri Nov 26 10:48:30 2010 +0000
@@ -1,3 +1,11 @@
+2010-11-26  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE #323
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java:
+	  In addition to the last revision: XML documents of HTTP Post request are
+	  also logged to the logfile.
+
 2010-11-26  Ingo Weinzierl <ingo@intevation.de>
 
 	  ISSUE #323
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java	Fri Nov 26 10:04:22 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java	Fri Nov 26 10:48:30 2010 +0000
@@ -9,6 +9,7 @@
 package de.intevation.gnv.action.mapviewer;
 
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -64,7 +65,6 @@
         log.debug("MapViewerCallAction.execute");
         InputStream inputStream = null;
         String documentvalue = request.getParameter("document");
-        log.debug("REQUEST DOCUMENT: " + documentvalue);
         if (documentvalue != null){
             documentvalue = documentvalue.trim();
             inputStream = new ByteArrayInputStream(documentvalue.getBytes());
@@ -73,6 +73,18 @@
         }
 
         if (inputStream != null){
+
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            byte[] b = new byte[4096];
+            int i = -1;
+            while ((i = inputStream.read(b)) > 0) {
+                out.write(b, 0, i);
+            }
+            out.close();
+            inputStream.reset();
+
+            log.debug("REQUEST DOCUMENT: " + out.toString());
+
             try {
                 ExternalCallParser ecp = new XMLExternalCallParser(inputStream);
                 ecp.parse();

http://dive4elements.wald.intevation.org