diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2006-06-26 14:50:59 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2006-06-26 14:50:59 +0000 |
commit | e06e1534392fadfd84c84fb403be56fa9c852fdb (patch) | |
tree | 8a924d4f5a5080dec1bd4e5d4ab53e0e8f6184f7 /spss.slinterface/WEB-INF/src/test | |
parent | a8c6c5e86da29a1e17d73f672b95bf58e8aa6de0 (diff) | |
download | moa-id-spss-e06e1534392fadfd84c84fb403be56fa9c852fdb.tar.gz moa-id-spss-e06e1534392fadfd84c84fb403be56fa9c852fdb.tar.bz2 moa-id-spss-e06e1534392fadfd84c84fb403be56fa9c852fdb.zip |
Verzeichnis verschoben nach /src
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@714 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/test')
3 files changed, 0 insertions, 202 deletions
diff --git a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLBean.java b/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLBean.java deleted file mode 100644 index 4cf099a45..000000000 --- a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLBean.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Created on 25.11.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package test.at.gv.egovernment.moa.spss.slinterface; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) - */ -public class DataURLBean -{ - String title_; - String contentType_; - String content_; - - public DataURLBean() - { - super(); - title_="unknown"; - contentType_="unknown"; - content_="unknown"; - } - - public DataURLBean(String title, String contentType, String content) - { - title_ = title; - contentType_ = contentType; - content_ = content; - } - - public String getTitle() - { - return title_; - } - - public String getContentType() - { - return contentType_; - } - - public String getContent() - { - return content_; - } -} diff --git a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java b/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java deleted file mode 100644 index ff4cbbe59..000000000 --- a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Created on 25.11.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package test.at.gv.egovernment.moa.spss.slinterface; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -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 DataURLServlet extends HttpServlet -{ - private static Logger logger_ = Logger.getLogger(Constants.LH_TEST_); - - public DataURLServlet() - { - super(); - } - - /* ---------------------------------------------------------------------------------------------------- */ - - public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException - { - // Read content form POST request - try - { - logger_.debug("Received POST request:"); - logger_.debug("Content type: \"" + request.getContentType() + "\"."); - byte[] contentBytes = Utils.readFromInputStream(request.getInputStream()); - String contentStr = new String(contentBytes); - logger_.debug("Content:\n" + new String(contentStr)); - - StringBuffer contentStrBuf = new StringBuffer(contentStr); - int startPos = 0; - while (startPos < contentStrBuf.length()) - { - if (contentStrBuf.charAt(startPos) == '<') - { - contentStrBuf.replace(startPos, startPos + 1, "<"); - startPos += 4; - } - startPos++; - } - contentStr = contentStrBuf.toString(); - - DataURLBean dataURLBean = new DataURLBean("Data URL Results", request.getContentType(), contentStr); - request.setAttribute("dataURLResult", dataURLBean); - } - catch (Exception e) - { - String message = "Failed to read content from POST request."; - logger_.error(message, e); - throw new ServletException(message, e); - } - - // Invoke response JSP page - try - { - response.setContentType("text/html"); - RequestDispatcher dispatcher = request.getRequestDispatcher("/pages/test/dataURL.jsp"); - dispatcher.include(request, response); - } - catch (IOException e) - { - String message = "Failed to send simple HTML answer to client."; - logger_.error(message, e); - throw new ServletException(message, e); - } - } -} 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 deleted file mode 100644 index 46b1f793d..000000000 --- a/spss.slinterface/WEB-INF/src/test/at/gv/egovernment/moa/spss/slinterface/RewriteServlet.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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); - } - } -} |