diff options
Diffstat (limited to 'spss.slinterface/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java')
-rw-r--r-- | spss.slinterface/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/spss.slinterface/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java b/spss.slinterface/src/test/at/gv/egovernment/moa/spss/slinterface/DataURLServlet.java deleted file mode 100644 index ff4cbbe59..000000000 --- a/spss.slinterface/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); - } - } -} |