aboutsummaryrefslogtreecommitdiff
path: root/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface
diff options
context:
space:
mode:
authorgregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2003-12-16 11:26:04 +0000
committergregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2003-12-16 11:26:04 +0000
commit30b51f122dac66296e5b17c9ca2cc89a871ffdc2 (patch)
treed4947622f94132c6d026e1a1fc47913c2614b7d3 /spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface
parentbedb12d7f975451198071b5b3f7102c248879592 (diff)
downloadmoa-id-spss-30b51f122dac66296e5b17c9ca2cc89a871ffdc2.tar.gz
moa-id-spss-30b51f122dac66296e5b17c9ca2cc89a871ffdc2.tar.bz2
moa-id-spss-30b51f122dac66296e5b17c9ca2cc89a871ffdc2.zip
Rewrite der URLs für signierte Dateien und Bilder implementiert und getestet.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@74 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface')
-rw-r--r--spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/RewriteServlet.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/RewriteServlet.java b/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/RewriteServlet.java
new file mode 100644
index 000000000..46b1f793d
--- /dev/null
+++ b/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/RewriteServlet.java
@@ -0,0 +1,73 @@
+/*
+ * Created on 15.12.2003
+ *
+ * (c) Stabsstelle IKT-Strategie des Bundes
+ */
+package test.at.gv.egovernment.moa.spss.slinterface;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import at.gv.egovernment.moa.spss.slinterface.Constants;
+import at.gv.egovernment.moa.spss.slinterface.Utils;
+
+/**
+ * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
+ */
+public class RewriteServlet extends HttpServlet
+{
+ private static Logger logger_ = Logger.getLogger(Constants.LH_TEST_);
+
+ public RewriteServlet()
+ {
+ super();
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
+ {
+ // Read content form POST request
+ try
+ {
+ logger_.debug("Received GET request:");
+ logger_.debug("Request URI: \"" + request.getRequestURL() + "\"");
+
+ Properties initProps = (Properties) this.getServletContext().getAttribute(Constants.WSCP_INIT_PROPS_);
+ String paramName = (initProps != null)
+ ? initProps.getProperty(Constants.IP_REW_SLI_URLPARAMNAME_)
+ : null;
+
+ if (paramName == null || "".equals(paramName))
+ throw new ServletException("Could not get rewrite parameter name from init properties.");
+
+ logger_.debug("SLInterface rewrite parameter : \"" + paramName + "\"");
+
+ String slInterfaceURLStr = request.getParameter(paramName);
+ URL slInterfaceURL = new URL(slInterfaceURLStr);
+ URLConnection slInterfaceURLConn = slInterfaceURL.openConnection();
+
+ response.setContentType(slInterfaceURLConn.getContentType());
+
+ InputStream slInterfaceIS = slInterfaceURLConn.getInputStream();
+ OutputStream responseOS = response.getOutputStream();
+ Utils.transferStreams(slInterfaceIS, responseOS);
+ }
+ catch (Exception e)
+ {
+ String message = "Failed to get answer from SL interface.";
+ logger_.error(message, e);
+ throw new ServletException(message, e);
+ }
+ }
+}