aboutsummaryrefslogtreecommitdiff
path: root/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets
diff options
context:
space:
mode:
author(no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-06 14:26:08 +0000
committer(no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-06 14:26:08 +0000
commitf25a072fd1c3b131d5f2f15689942ca7c55a62c0 (patch)
treebb9a27f99ebbb16c8513ec4bbd72f8f4912b3367 /spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets
parent3c1368b8d7182973c15f10e9ade3c1a0bb4fbaa7 (diff)
downloadmoa-id-spss-f25a072fd1c3b131d5f2f15689942ca7c55a62c0.tar.gz
moa-id-spss-f25a072fd1c3b131d5f2f15689942ca7c55a62c0.tar.bz2
moa-id-spss-f25a072fd1c3b131d5f2f15689942ca7c55a62c0.zip
This commit was manufactured by cvs2svn to create tagtags/Build-ID-1_4_0
'Build-ID-1_4_0'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Build-ID-1_4_0@907 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets')
-rw-r--r--spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java93
-rw-r--r--spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/MOAServlet.java113
-rw-r--r--spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/ReturnServlet.java129
-rw-r--r--spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/SLRequest.java19
4 files changed, 0 insertions, 354 deletions
diff --git a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java b/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java
deleted file mode 100644
index 1f82540bb..000000000
--- a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Created on 01.12.2003
- *
- * (c) Stabsstelle IKT-Strategie des Bundes
- */
-package at.gv.egovernment.moa.spss.slinterface.servlets;
-
-import java.io.FileInputStream;
-import java.io.OutputStream;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.log4j.Logger;
-
-import at.gv.egovernment.moa.spss.slinterface.Constants;
-import at.gv.egovernment.moa.spss.slinterface.Utils;
-import at.gv.egovernment.moa.spss.slinterface.beans.DataInfoBean;
-
-/**
- * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
- */
-public class HashInputDataServlet extends HttpServlet
-{
- private static Logger logger_ = Logger.getLogger(Constants.LH_SERVLETS_);
-
- /**
- * Default constructor.
- */
- public HashInputDataServlet()
- {
- super();
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
- {
- // Get DataInfoBean object from session
- HttpSession session = request.getSession(false);
- if (session == null)
- {
- String message = "No session available.";
- logger_.error(message);
- throw new ServletException(message);
- }
- DataInfoBean dataInfo = (DataInfoBean) session.getAttribute("dataInfo");
-
- // Get parameter inicating which hash input data file to show
- String hidCountStr = request.getParameter("hidCount");
- if (hidCountStr == null)
- {
- String message = "Parameter \"hidCount\" not available in request.";
- logger_.error(message);
- throw new ServletException(message);
- }
- int hidCount = -1;
- try
- {
- hidCount = Integer.parseInt(hidCountStr);
- }
- catch (NumberFormatException e)
- {
- String message = "Parameter \"hidCount\" (\"" + hidCount + "\") is not a valid string representation of an integer.";
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
-
- // Get file name of temporary HID file
- dataInfo.setHashInputDataCount(hidCount);
- String hidFilename = dataInfo.getHashInputDataFilename();
-
- // Set content type
- boolean isSLXHTML = dataInfo.getIsSLXHTMLDocument();
- String contenType = (isSLXHTML) ? "text/html;charset=utf-8" : "application/octet-stream";
- response.setContentType(contenType);
-
- // Write content from temporary HID file to response OS
- try
- {
- FileInputStream hidFIS = new FileInputStream(hidFilename);
- OutputStream responseOS = response.getOutputStream();
- Utils.transferStreams(hidFIS, responseOS);
- }
- catch (Exception e)
- {
- String message = "Writing hash input data to response stream failed.";
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
- }
-}
diff --git a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/MOAServlet.java b/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/MOAServlet.java
deleted file mode 100644
index 362793064..000000000
--- a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/MOAServlet.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Created on 19.11.2003
- *
- * (c) Stabsstelle IKT-Strategie des Bundes
- */
-package at.gv.egovernment.moa.spss.slinterface.servlets;
-
-import java.io.IOException;
-import java.rmi.RemoteException;
-import java.util.Properties;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.rpc.ServiceException;
-
-import org.apache.log4j.Logger;
-import org.apache.xerces.parsers.DOMParser;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import at.gv.egovernment.moa.spss.slinterface.Constants;
-import at.gv.egovernment.moa.spss.slinterface.moainvoker.MOAInvoker;
-
-/**
- * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
- */
-public class MOAServlet extends HttpServlet
-{
- private static Logger logger_ = Logger.getLogger(Constants.LH_SERVLETS_);
-
- /**
- * Default constructor.
- */
- public MOAServlet()
- {
- super();
- }
-
- public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException
- {
- // Get moa request form http request
- Document moaXmlRequest = null;
- DOMParser xmlParser = (DOMParser) this.getServletContext().getAttribute(Constants.WSCP_XMLPARSER_);
- try
- {
- InputSource requestIS = new InputSource(request.getInputStream());
- xmlParser.parse(requestIS);
- moaXmlRequest = xmlParser.getDocument();
- }
- catch (IOException ioe)
- {
- String message = "Getting MOA XML request from http request input failed.";
- logger_.error(message, ioe);
- throw new ServletException(message, ioe);
- }
- catch (SAXException se)
- {
- String message = "Parsing MOA XML request got from http request failed.";
- logger_.error(message, se);
- throw new ServletException(message, se);
- }
-
- // Send request to MOA SP
- Properties initProps = (Properties) this.getServletContext().getAttribute(Constants.WSCP_INIT_PROPS_);
- String endPoint = initProps.getProperty(Constants.IP_SP_ENDPOINT_);
- if (endPoint == null)
- {
- String message = "No endpoint configured for MOA SP service.";
- logger_.error(message);
- throw new ServletException(message);
- }
- Document moaXMLResponseDoc = null;
- try
- {
- moaXMLResponseDoc = MOAInvoker.invokeSP(moaXmlRequest, endPoint);
- }
- catch (Exception e)
- {
- String message;
- if (e instanceof RemoteException)
- {
- message = "MOA SP service indicated an error at request execution.";
- }
- else if (e instanceof ServiceException)
- {
- message = "MOA SP client indicated an error at request execution.";
- }
- else
- {
- message = "Could not create DOM Document from MOA SP service response.";
- }
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
- logger_.debug("Got response from MOA SP service.");
-
- // Write moa response to http response
- try
- {
- MOAInvoker.serializeDocument(moaXMLResponseDoc, response.getOutputStream());
- }
- catch (IOException e)
- {
- String message = "Writing MOA SP XML response to http response failed.";
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
- logger_.debug("Wrote response from MOA SP service to http response outputstream.");
- }
-}
diff --git a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/ReturnServlet.java b/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/ReturnServlet.java
deleted file mode 100644
index 84ce26be0..000000000
--- a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/ReturnServlet.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Created on 25.11.2003
- *
- * (c) Stabsstelle IKT-Strategie des Bundes
- */
-package at.gv.egovernment.moa.spss.slinterface.servlets;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
-import at.gv.egovernment.moa.spss.slinterface.Constants;
-import at.gv.egovernment.moa.spss.slinterface.Utils;
-import at.gv.egovernment.moa.spss.slinterface.moainvoker.MOAInvoker;
-
-/**
- * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
- */
-public class ReturnServlet extends HttpServlet
-{
-
- private static Logger logger_ = Logger.getLogger(Constants.LH_SERVLETS_);
-
- /**
- * Default constructor.
- */
- public ReturnServlet()
- {
- super();
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
- {
- // Get session
- HttpSession session = request.getSession(false);
- if (session == null)
- {
- String message = "No session available.";
- logger_.error(message);
- throw new ServletException(message);
- }
-
- // Get original SL request from session
- SLRequest slRequest = (SLRequest) session.getAttribute("slRequest");
- if (slRequest == null)
- {
- String message = "Session object \"slRequest\" not available.";
- logger_.error(message);
- throw new ServletException(message);
- }
-
- // Get SL response from session
- Document slResponseDoc = (Document) session.getAttribute("slResponseDoc");
- if (slResponseDoc == null)
- {
- String message = "Session object \"slResponseDoc\" not available.";
- logger_.error(message);
- throw new ServletException(message);
- }
-
- URLConnection dataURLConn;
- try
- {
- // TODO Does not conform to SL/Bindings/sec. 3.3.2.2
-
- // Open connection to DataURL
- URL dataURL = new URL(slRequest.dataUrl_);
- dataURLConn = dataURL.openConnection();
- dataURLConn.setDoOutput(true);
- OutputStream dataURLOS = dataURLConn.getOutputStream();
- MOAInvoker.serializeDocument(slResponseDoc, dataURLOS);
- dataURLOS.flush();
- }
- catch (Exception e)
- {
- String message = "Sending SL XML response to DataURL failed.";
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
-
- // Forward response from DataURL to client
- forwardResponse(dataURLConn, response);
-
- session.invalidate();
- }
-
- /* ---------------------------------------------------------------------------------------------------- */
-
- private void forwardResponse(URLConnection dataURLConn, ServletResponse response) throws ServletException
- {
- // TODO Does not conform to SL/Bindings/sec. 3.3.2.1
-
- // Make sure that content type of DataURL response is text/html
- String dataURLContentType = dataURLConn.getContentType();
- if (dataURLContentType == null || !dataURLContentType.startsWith("text/html"))
- {
- String message = "Unsupported content type of DataURL response: \"" + dataURLContentType + "\".";
- logger_.error(message);
- throw new ServletException(message);
- }
-
- try
- {
- InputStream dataURLIS = dataURLConn.getInputStream();
- byte[] dataURLResponse = Utils.readFromInputStream(dataURLIS);
- response.setContentType("text/html");
- OutputStream responseOS = response.getOutputStream();
- responseOS.write(dataURLResponse);
- responseOS.flush();
- }
- catch (Exception e)
- {
- String message = "Forwarding DataURL response to client failed.";
- logger_.error(message, e);
- throw new ServletException(message, e);
- }
- }
-}
diff --git a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/SLRequest.java b/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/SLRequest.java
deleted file mode 100644
index 3c19d5ff6..000000000
--- a/spss.slinterface/src/at/gv/egovernment/moa/spss/slinterface/servlets/SLRequest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Created on 25.11.2003
- *
- * (c) Stabsstelle IKT-Strategie des Bundes
- */
-package at.gv.egovernment.moa.spss.slinterface.servlets;
-
-/**
- * Helper class, representing the fields of a Security-Layer request.
- *
- * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
- */
-public class SLRequest
-{
- public String xmlRequest_;
- public String dataUrl_;
- public String stylesheetUrl_;
- public String redirectUrl_;
-}