aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-06 16:55:24 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-06 16:55:24 +0000
commitf4f361e0e8af41e3d12ee3e36a1ba11e60a12077 (patch)
tree70d5f4c064b69df2980ed065ad2ae07cfe2e4b48 /src/main/java/at/knowcenter/wag/egov/egiz
parentbab89f89456290660afeb320a7bd3444bd79f9bb (diff)
downloadpdf-as-3-f4f361e0e8af41e3d12ee3e36a1ba11e60a12077.tar.gz
pdf-as-3-f4f361e0e8af41e3d12ee3e36a1ba11e60a12077.tar.bz2
pdf-as-3-f4f361e0e8af41e3d12ee3e36a1ba11e60a12077.zip
Moved to pdf-as-web project
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@676 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousDataResponder.java176
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java184
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java28
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java244
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequest.java80
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java503
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/PDFContainer.java27
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java116
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java62
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/SessionInformation.java160
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/SessionTable.java94
11 files changed, 0 insertions, 1674 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousDataResponder.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousDataResponder.java
deleted file mode 100644
index 7bba97b..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousDataResponder.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: AsynchronousDataResponder.java,v 1.3 2006/08/30 14:02:35 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.List;
-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.servlet.http.HttpSession;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.log4j.Logger;
-
-import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
-import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-import at.knowcenter.wag.egov.egiz.sig.connectors.BKUPostConnection;
-
-/**
- * Servlet that responds to the data post requests of the local service (e.g.
- * BKU).
- *
- * @deprecated
- *
- * @author wprinz
- */
-public class AsynchronousDataResponder extends HttpServlet
-{
-
- /**
- * SVUID.
- */
- private static final long serialVersionUID = -4992297156381763174L;
-
-// /**
-// * The logger definition.
-// */
-// private static final Logger logger_ = ConfigLogger.getLogger(AsynchronousDataResponder.class);
-//
-// protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException
-// {
-// logger_.debug("AsyncDataResp GET REQUEST.");
-// super.doGet(arg0, arg1);
-// }
-//
-// protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
-// {
-// logger_.debug("AsyncDataResp !!!!!!!!!!!!!!!!!!!!!!");
-//
-// HttpSession session = request.getSession(false);
-// if (session == null)
-// {
-// throw new ServletException("There is no session associated with this request.");
-// }
-//
-// // String session_id_string = request.getParameter("session");
-// // if (session_id_string == null)
-// // {
-// // throw new ServletException("The session parameter is missing.");
-// // }
-//
-// SessionInformation si = (SessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
-// // long session_id = Long.parseLong(session_id_string);
-// // SessionInformation si = SessionTable.get(session_id);
-// if (si == null)
-// {
-// throw new ServletException("The session is not found or no longer valid.");
-// }
-//
-// // InputStream is = request.getInputStream();
-// // byte [] data = new byte[request.getContentLength()];
-// // is.read(data);
-// // is.close();
-// // String enc = request.getCharacterEncoding();
-// // String ct = request.getContentType();
-// // Enumeration enum = request.getHeaderNames();
-// //
-// // String dat = new String(data, "US-ASCII");
-// // // dat looks like: XMLResponse=blablabla ...
-// // // so the actual XMLResponse begins after the =
-// // String resp = URLDecoder.decode(dat, "UTF-8");
-//
-// logger_.debug("Answer from local service: content-type = '" + request.getContentType() + "', character encoding = '" + request.getCharacterEncoding() + "'");
-//
-// // .getParameter will use the character encoding specified by the
-// // content-type header.
-// // Unfortunately BKU forgets to specify a chatacter encoding.
-// // Therefor, .getParameter will assume US-ASCII or something.
-// // ==> we explicitely set UTF-8
-// if (request.getCharacterEncoding() == null)
-// {
-// request.setCharacterEncoding("UTF-8");
-// logger_.debug(" no character encoding specified - set to UTF-8");
-// }
-//
-// logger_.debug("AsyncDataResponder: si.current_operation = " + si.current_operation);
-//
-// String resp_string = request.getParameter("XMLResponse");
-// if (resp_string == null)
-// {
-// logger_.debug("response String is null => trying multipart form");
-//
-// DiskFileItemFactory fif = new DiskFileItemFactory();
-// fif.setRepository(SettingsReader.getTemporaryDirectory());
-// ServletFileUpload sfu = new ServletFileUpload(fif);
-//
-// try
-// {
-// List items = sfu.parseRequest(request);
-//
-// for (int i = 0; i < items.size(); i++)
-// {
-// FileItem item = (FileItem) items.get(i);
-// logger_.debug("item = " + item.getFieldName());
-//
-// if (item.getFieldName().equals("XMLResponse"))
-// {
-// resp_string = item.getString("UTF-8");
-// }
-// }
-// }
-// catch (FileUploadException e)
-// {
-// throw new ServletException("File Upload exception. cannot parse POST data");
-// }
-//
-// }
-//
-// // TODO hotfix - already deprecated
-// if (logger_.isDebugEnabled())
-// {
-// Enumeration header_names = request.getHeaderNames();
-// while (header_names.hasMoreElements())
-// {
-// String header_name = (String)header_names.nextElement();
-// String header_value = request.getHeader(header_name);
-// logger_.debug("header: name = " + header_name + ", value = " +header_value);
-// }
-// }
-// String user_agent = request.getHeader("User-Agent");
-// logger_.debug("User-Agent header = " + user_agent);
-// Properties response_properties = new Properties();
-// BKUPostConnection.parseBKUVersion(user_agent, response_properties);
-// response_properties.setProperty("response_string", resp_string);
-// si.response_properties[si.current_operation] = response_properties; //request.getParameter("XMLResponse");
-// //logger_.debug("AsyncDataResponder: si.response_string[si.current_operation] = " + si.response_string[si.current_operation]);
-//
-// si.current_operation++;
-//
-// si.finished = true;
-//
-// LocalRequestHelper.formatBKUOkResponse(response);
-// }
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java
deleted file mode 100644
index 695b95c..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: AsynchronousRedirectResponder.java,v 1.4 2006/10/11 07:39:13 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import javax.servlet.http.HttpServlet;
-
-/**
- * Servlet that responds to the redirect requests of the local service (e.g.
- * BKU).
- *
- * @deprecated remove this
- *
- * @author wprinz
- */
-public class AsynchronousRedirectResponder extends HttpServlet
-{
-
- /**
- * SVUID.
- */
- private static final long serialVersionUID = -682360466333727236L;
-
-// /**
-// * The logger definition.
-// */
-// private static final Logger logger_ = ConfigLogger.getLogger(AsynchronousRedirectResponder.class);
-//
-// protected void dispatch(HttpServletRequest request,
-// HttpServletResponse response, String resource) throws ServletException, IOException
-// {
-// response.setContentType("text/html");
-// response.setCharacterEncoding("UTF-8");
-//
-// RequestDispatcher disp = getServletContext().getRequestDispatcher(resource);
-// disp.forward(request, response);
-// }
-//
-// protected void dispatchToResults(List results, HttpServletRequest request,
-// HttpServletResponse response) throws ServletException, IOException
-// {
-// request.setAttribute("results", results);
-// dispatch(request, response, "/jsp/results.jsp");
-// }
-//
-// protected void dispatchToRedirectRefreshPage (HttpServletRequest request,
-// HttpServletResponse response, String refresh_url) throws ServletException, IOException
-// {
-// request.setAttribute("refresh_url", refresh_url);
-// dispatch(request, response, LocalRequestHelper.REDIRECT_REFRESH_PAGE_JSP);
-// }
-//
-// protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
-// {
-// logger_.debug("AsyncRedirResp");
-//
-// SessionInformation si = null;
-//
-// HttpSession session = null;
-// try
-// {
-// session = request.getSession(false);
-// //String session_id_string = request.getParameter("session");
-// if (session == null)
-// {
-// throw new ErrorCodeException(600, "The session is missing.");
-// }
-//
-// si = (SessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
-//// long session_id = Long.parseLong(session_id_string);
-//// si = SessionTable.get(session_id);
-// if (si == null)
-// {
-// throw new ErrorCodeException(600, "The session is not found or is no longer valid.");
-// }
-//
-// }
-// catch (PresentableException e)
-// {
-// e.printStackTrace();
-// SignServlet.prepareDispatchToErrorPage(e, request);
-// dispatch(request, response, "/jsp/error.jsp");
-//
-// return;
-// }
-//
-// try
-// {
-// if (si.finished == false)
-// {
-// String url = request.getRequestURL().toString();
-// logger_.debug("RequestURL = " + url);
-// String refresh_url = response.encodeURL(url);
-// logger_.debug("RefreshURL = " + refresh_url);
-// dispatchToRedirectRefreshPage(request, response, refresh_url);
-// return;
-// }
-//
-// // si.finished is true, but maybe there are more requests to process.
-// if (si.current_operation < si.requests.length)
-// {
-// si.finished = false;
-//
-// LocalRequestHelper.prepareDispatchToLocalConnectionPage(si.requests[si.current_operation], request, response);
-// dispatch(request, response, LocalRequestHelper.LOCAL_CONNECTION_PAGE_JSP);
-// return;
-// }
-//
-// // all requests have been carried out.
-//
-// BKUConnector local_conn = (BKUConnector) ConnectorFactory.createConnector(si.connector);
-//
-// if (si.application.equals("verify"))
-// {
-// List results = new ArrayList();
-//
-// for (int i = 0; i < si.response_properties.length; i++)
-// {
-// SignatureResponse sig_resp = local_conn.analyzeVerifyResponse(si.response_properties[i]);
-// results.add(sig_resp);
-// }
-//
-// dispatchToResults(results, request, response);
-// }
-// else
-// {
-// //logger_.debug("AsyncRedirResponder: si.response_string[0] = " + si.response_string[0]);
-// logger_.debug("AsyncRedirResponder: si.current_op = " + si.current_operation);
-//
-// // The response string must not be null here - otherwise finished mustn't have been set!
-//// if (si.response_string[0] == null)
-//// {
-//// String url = request.getRequestURL().toString();
-//// logger_.debug("RequestURL = " + url);
-//// String refresh_url = response.encodeURL(url);
-//// logger_.debug("RefreshURL = " + refresh_url);
-//// dispatchToRedirectRefreshPage(request, response, refresh_url);
-//// return ;
-//// }
-//
-// // A download blocker may have blocked the first download.
-// // So, if the user asks for the document a second time and the sign_result
-// // has already been computed - don't recompute it.
-// if (si.sign_result == null)
-// {
-// // refactor WEB
-// si.iui.signed_signature_object = null; //local_conn.analyzeSignResponse(si.response_properties[0], si.type);
-//
-// PdfASID algorithm = FormFields.translateSignatureModeToPdfASID(si.mode);
-// Signator signator = SignatorFactory.createSignator(algorithm);
-//
-// si.sign_result = signator.finishSign(si.iui);
-// }
-//
-// SignServlet.returnSignResponse(si, response);
-// }
-//
-// }
-// catch (PresentableException e)
-// {
-// session.removeAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
-// //SessionTable.remove(si.session_id);
-//
-// e.printStackTrace();
-// SignServlet.prepareDispatchToErrorPage(e, request);
-// dispatch(request, response, "/jsp/error.jsp");
-// }
-//
-// }
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java
deleted file mode 100644
index d00ec61..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.Serializable;
-
-public class ExternAppInformation implements Serializable {
-
- /**
- * SVUID.
- */
- private static final long serialVersionUID = 1L;
-
- public String invoke_url;
- public long pdf_id;
- public String session_id;
- public String invoke_error_url;
-
- public ExternAppInformation(String url, String id, String session_id) {
- this(url, id, session_id, null);
- }
-
- public ExternAppInformation(String url, String id, String session_id, String errorUrl) {
- this.invoke_url = url;
- this.pdf_id = Long.parseLong(id);
- this.session_id = session_id;
- this.invoke_error_url = errorUrl;
- }
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java
deleted file mode 100644
index e60bdba..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: FormFields.java,v 1.4 2006/10/11 07:39:13 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.servlet.ServletException;
-
-import at.knowcenter.wag.egov.egiz.PdfASID;
-import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException;
-import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
-import at.knowcenter.wag.egov.egiz.framework.SignatorFactory;
-import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
-import at.knowcenter.wag.egov.egiz.sig.ConnectorInformation;
-import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
-
-/**
- * Helper class that provides methods and constants for creating and dealing
- * with the various form fields.
- *
- * @author wprinz
- */
-public abstract class FormFields
-{
- public static final String FIELD_UPLOAD = "upload";
-
- public static final String FIELD_CONNECTOR = "connector";
-
- public static final String FIELD_MODE = "mode";
-
- public static final String FIELD_PREVIEW = "preview";
-
- public static final String FIELD_RAW_DOCUMENT_TEXT = "raw_document_text";
-
- public static final String FIELD_SIGNATURE_TYPE = "sig_type";
-
- // tknall: PDF/A-1b enabled
- public static final String FIELD_PDFA_ENABLED = "pdfa_enabled";
-
- public static final String FIELD_VERIFY_WHICH = "verify_which";
-
- public static final String FIELD_DOWNLOAD = "download";
-
- public static final String VALUE_TRUE = "true";
-
- public static final String VALUE_FALSE = "false";
-
- public static final String VALUE_MODE_BINARY = "binary";
-
- public static final String VALUE_MODE_TEXTUAL = "textual";
-
- public static final String VALUE_MODE_DETACHED = "detached";
-
- public static final String VALUE_VERIFY_WHICH_ALL = "all";
-
- public static final String VALUE_DOWNLOAD_INLINE = "inline";
-
- public static final String VALUE_DOWNLOAD_ATTACHMENT = "attachment";
-
- protected static final String STYLE_CLASS_FIELD = "field";
-
- // tzefferer: added fields for URL requests
-
- public static final String FIELD_FILENAME = "filename";
-
- public static final String FIELD_PDF_URL = "pdf-url";
-
- public static final String FIELD_PDF_ID = "pdf-id";
-
- public static final String FIELD_PDFAS_SESSION_ID = "pdfas-session-id";
-
- public static final String FIELD_FILE_LENGTH = "num-bytes";
-
- public static final String FIELD_INVOKE_APP_URL = "invoke-app-url";
-
- public static final String FIELD_INVOKE_APP_ERROR_URL = "invoke-app-error-url";
-
- public static final String FIELD_SESSION_ID = "session-id";
-
- public static final String FIELD_SIGPOS_Y = "sig-pos-y";
-
- public static final String FIELD_SIGPOS_P = "sig-pos-p";
-
- public static final String FIELD_SOURCE = "source_filefreetext";
-
- public static final String VALUE_SOURCE_FILE = "source-is-file";
-
- public static final String VALUE_SOURCE_FREETEXT = "source-is-freetext";
-
- public static final String FIELD_FREETEXT = "freetext";
-
- // end add
-
-
- /**
- * Translates the form field to a PDF-AS-ID.
- *
- * @param signature_mode
- * The signator mode form field.
- * @return Returns the corresponding PDFASID.
- */
- public static PdfASID translateSignatureModeToPdfASID(String signature_mode)
- {
- if (signature_mode.equals(VALUE_MODE_BINARY))
- {
- return SignatorFactory.MOST_RECENT_BINARY_SIGNATOR_ID;
- }
- if (signature_mode.equals(VALUE_MODE_TEXTUAL))
- {
- return SignatorFactory.MOST_RECENT_TEXTUAL_SIGNATOR_ID;
- }
- if (signature_mode.equals(VALUE_MODE_DETACHED))
- {
- return SignatorFactory.MOST_RECENT_DETACHED_SIGNATOR_ID;
- }
- return null;
- }
-
- /**
- * Generates the HTML snippet of a FIELD_CONNECTOR select box that allows to
- * choose a connector.
- *
- * @return Returns the HTML snippet.
- * @throws SettingsException
- * Forwarded exception.
- * @throws ConnectorFactoryException
- * Forwarded exception.
- */
- public static String generateConnectorSelectBox() throws SettingsException, ConnectorFactoryException
- {
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
-
- writer.println("<select name=\"" + FIELD_CONNECTOR + "\" class=\"" + STYLE_CLASS_FIELD + "\">");
-
- SettingsReader settings = SettingsReader.getInstance();
- String default_connector = settings.getValueFromKey(SignatureTypes.DEFAULT_TYPE);
-
- ConnectorInformation ci[] = ConnectorFactory.getConnectorInformationArray();
-
- for (int i = 0; i < ci.length; i++)
- {
- String id = ci[i].getIdentifier();
- if (!ConnectorFactory.isAvailableForWeb(id))
- {
- continue;
- }
-
- writer.print("<option value=\"" + id + "\"");
- if (id.equals(default_connector))
- {
- writer.print(" selected=\"selected\"");
- }
- writer.println(">" + ci[i].getDescription() + "</option>");
- }
-
- writer.println("</select>");
-
- return sw.toString();
- }
-
- /**
- * Generates a HTML snippet of a FIELD_SIGNATURE_TYPE select box that allows
- * to choose the signature type.
- *
- * @return Returns the HTML snippet.
- * @throws ServletException
- * Forwarded exception.
- */
- public static String generateTypeSelectBox() throws ServletException
- {
- try
- {
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
-
- SettingsReader settings = SettingsReader.getInstance();
- SignatureTypes sig_types = SignatureTypes.getInstance();
-
- // SettingsReader settings = null;
- // SignatureTypes sig_types = null;
- // try
- // {
- // settings = SettingsReader.getInstance();
- // sig_types = SignatureTypes.getInstance();
- // }
- // catch (IOException e)
- // {
- // String log_message = "Can not load signature settings. Cause:\n" +
- // e.getMessage();
- // logger_.error(log_message);
- // req.setAttribute("error", "Das System konnte nicht gestartet werden.");
- // req.setAttribute("cause", "Die Konfiguration ist fehlerhaft oder konnte
- // nicht geladen werden.");
- // dispatch(req, res, "/jsp/error.jsp");
- // }
-
- Set types_array = sig_types.getSignatureTypes();
- Iterator type_it = types_array.iterator();
-
- String default_type = settings.getValueFromKey(SignatureTypes.DEFAULT_TYPE);
-
- writer.println("<select class=\"" + STYLE_CLASS_FIELD + "\" name=\"" + FIELD_SIGNATURE_TYPE + "\">");
-
- while (type_it.hasNext())
- {
- String type = (String) type_it.next();
- String descr_key = SignatureTypes.SIG_OBJ + type + "." + SignatureTypes.SIG_DESCR;
- String type_descr = settings.getValueFromKey(descr_key);
-
- writer.println("<option value=\"" + type + "\" " + (type.equals(default_type) ? "selected=\"selected\"" : "") + ">" + type_descr + "</option>");
-
- }
-
- writer.println("</select>");
-
- return sw.toString();
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequest.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequest.java
deleted file mode 100644
index d3c24a7..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: LocalRequest.java,v 1.2 2006/08/25 17:06:11 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.Serializable;
-
-/**
- * Encapsulates a local request, basicall an URL where the local request is sent
- * to and a request string.
- *
- * @author wprinz
- */
-public class LocalRequest implements Serializable
-{
-
- /**
- * SVUID.
- */
- private static final long serialVersionUID = -3734904043231861998L;
-
- /**
- * The URL the local request sould be directed at.
- */
- protected String url_;
-
- /**
- * The request string to be sent to that URL.
- */
- protected String request_string_;
-
- /**
- * Constructor that initializes the URL and request string.
- *
- * @param url
- * The URL the local request sould be directed at.
- * @param request_string
- * The request string to be sent to that URL.
- */
- public LocalRequest(String url, String request_string)
- {
- this.url_ = url;
- this.request_string_ = request_string;
- }
-
- /**
- * Returns the URL.
- *
- * @return Returns the URL.
- */
- public String getUrl()
- {
- return url_;
- }
-
- /**
- * Returns the request string.
- *
- * @return Returns the request string.
- */
- public String getRequestString()
- {
- return request_string_;
- }
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
deleted file mode 100644
index 36db7b5..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: LocalRequestHelper.java,v 1.6 2006/10/31 08:22:04 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.pdfas.utils.WebUtils;
-import at.gv.egiz.pdfas.web.CurrentLocalOperation;
-import at.gv.egiz.pdfas.web.SignSessionInformation;
-import at.gv.egiz.pdfas.web.VerifySessionInformation;
-import at.knowcenter.wag.egov.egiz.PdfAS;
-import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
-import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException;
-import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException;
-import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
-import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
-import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder;
-import at.knowcenter.wag.egov.egiz.sig.SignatureData;
-import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
-import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorChooser;
-import at.knowcenter.wag.egov.egiz.sig.connectors.LocalConnector;
-import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
-import at.knowcenter.wag.egov.egiz.sig.signatureobject.SignatureObjectHelper;
-
-/**
- * Contains commonly used helper functions for the local request procedure.
- *
- * @author wprinz
- */
-public abstract class LocalRequestHelper
-{
-
- /**
- * The logger.
- */
- protected static Log logger = LogFactory.getLog(LocalRequestHelper.class);
-
- /**
- * The resource of the null request page jsp.
- */
- public static final String NULL_REQUEST_PAGE_JSP = "/jsp/null_request_page.jsp";
-
- /**
- * The resource of the local connection page jsp.
- */
- public static final String LOCAL_CONNECTION_PAGE_JSP = "/jsp/local_connection_page.jsp";
-
- /**
- * The resource of the redirect refresh page jsp.
- */
- public static final String REDIRECT_REFRESH_PAGE_JSP = "/jsp/redirect_refresh_page.jsp";
-
- /**
- * Sets up the local sign procedure.
- *
- * @param response
- * The HttpServletResponse the local request page is written to.
- * @throws IOException
- * Forwarded exception.
- * @throws PresentableException
- * Forwarded exception.
- */
- public static String processLocalSign(SignSessionInformation si, HttpServletRequest request, HttpServletResponse response) throws IOException, PresentableException
- {
- String host = request.getServerName();
-// URL loc_ref_URL = new URL(WebUtils.addJSessionID(getLocalContextAddress(request, response) + "/RetrieveSignatureData", request));
- URL loc_ref_URL = new URL(WebUtils.buildRetrieveSignatureDataURL(request, response));
- String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
-
- LocalConnector c = ConnectorChooser.chooseLocalConnectorForSign(si.connector, si.type, loc_ref_url);
- String sign_request = c.prepareSignRequest(si.si.getSignatureData());
-
- String local_request_url = getLocalServiceAddress(si.type, si.connector);
- si.localRequest = new LocalRequest(local_request_url, sign_request);
- si.outputAvailable = false;
- si.response_properties = null;
-
- URL data_URL = new URL(request.getScheme(), host, request.getServerPort(), WebUtils.addJSessionID(request.getContextPath() + "/DataURL", request));
- String data_url = response.encodeURL(data_URL.toString());
- logger.debug("data_url = " + data_url);
-
- request.setAttribute("local_request_url", local_request_url);
- request.setAttribute("data_url", data_url);
-
- return NULL_REQUEST_PAGE_JSP;
-
- // TODO old code - remove
- //
- // LocalConnector local_conn = (LocalConnector)
- // ConnectorFactory.createConnector(si.connector);
- //
- //
- // // refactor WEB
- // String document_text = "fixme"; //si.iui.document_text;
- // String request_string = local_conn.prepareSignRequest(si.user_name,
- // document_text, si.type);
- // String request_url = local_conn.getSignURL(si.type);
- //
- // LocalRequest local_request = new LocalRequest(request_url,
- // request_string);
- // List local_requests = new ArrayList();
- // local_requests.add(local_request);
- //
- // // ByteArrayOutputStream baos = new ByteArrayOutputStream();
- // // ObjectOutputStream oos = new ObjectOutputStream(baos);
- // // oos.writeObject(local_requests);
- // // oos.close();
- // // baos.close();
- //
- // si.requests = new LocalRequest[1];
- // si.requests[0] = new LocalRequest(local_conn.getSignURL(si.type),
- // request_string);
- // si.current_operation = 0;
- // si.response_properties = new Properties[1];
- // si.response_properties[0] = null;
- //
- // // SessionTable.put(si);
- // request.getSession().setAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION,
- // si);
- //
- // // byte [] requests_bytes = baos.toByteArray();
- // // String base64 = CodingHelper.encodeBase64(requests_bytes);
- //
- // LocalRequestHelper.prepareDispatchToLocalConnectionPage(si.requests[0],
- // request, response);
- }
-
- /**
- * Sets up the local verify procedure.
- *
- * @param response
- * The HttpServletResponse the local request page is written to.
- * @return Returns the JSP location where the calling servlet should dispatch
- * to.
- * @throws SignatureException
- * Forwarded exception.
- * @throws NormalizeException
- * Forwarded exception.
- * @throws IOException
- * Forwarded exception.
- * @throws ConnectorFactoryException
- * Forwarded exception.
- * @throws SettingsException
- * @throws ConnectorException
- */
- public static String processLocalVerify(VerifySessionInformation si, List holders_to_verify, HttpServletRequest request, HttpServletResponse response) throws SignatureException, NormalizeException,
- IOException, ConnectorFactoryException, SettingsException, ConnectorException
- {
- si.currentLocalOperation = new CurrentLocalOperation();
- si.currentLocalOperation.holders_to_be_verified = holders_to_verify;
-
- si.currentLocalOperation.requests = new LocalRequest[holders_to_verify.size()];
- si.currentLocalOperation.response_properties = new Properties[si.currentLocalOperation.requests.length];
-
- si.currentLocalOperation.current_operation = 0;
-// si.finished = false;
-
- String host = request.getServerName();
-// URL loc_ref_URL = new URL(WebUtils.addJSessionID(getLocalContextAddress(request, response) + "/RetrieveSignatureData", request));
- URL loc_ref_URL = new URL(WebUtils.buildRetrieveSignatureDataURL(request, response));
- String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
-
- for (int i = 0; i < si.currentLocalOperation.requests.length; i++)
- {
- SignatureHolder holder = (SignatureHolder) holders_to_verify.get(i);
-
- SignatureObject s = holder.getSignatureObject();
-
- SignatureData sd = PdfAS.convertSignatureHolderToSignatureData(holder);
-// if (holder.getSignatureObject().isBinary())
-// {
-// BinarySignatureHolder bsh = (BinarySignatureHolder) holder;
-// // byte[] data = CodingHelper.decodeBase64(text_to_be_verified);
-// // TODO what about the length of the PDF? is this correct - already deprecated
-// sd = new SignatureDataImpl(bsh.getSignedPdf(), "application/pdf");
-// }
-// else
-// {
-// String text_to_be_verified = holder.getSignedText();
-// DataSource ds = new TextDataSourceImpl(text_to_be_verified);
-// sd = new SignatureDataImpl(ds, "text/plain", "UTF-8");
-// }
-
- SignSignatureObject so = SignatureObjectHelper.convertSignatureObjectToSignSignatureObject(s);
-
- LocalConnector local_conn = ConnectorChooser.chooseLocalConnectorForVerify(si.connector, s.getKZ(), so.id, si.type, loc_ref_url);
- String request_string = local_conn.prepareVerifyRequest(sd, so, null);
-
- LocalRequest local_request = new LocalRequest("not-needed", request_string);
- si.currentLocalOperation.requests[i] = local_request;
- si.currentLocalOperation.response_properties[i] = null;
- }
-
- String local_request_url = getLocalServiceAddress(si.type, si.connector);
-
- URL data_URL = new URL(request.getScheme(), host, request.getServerPort(), WebUtils.addJSessionID(request.getContextPath() + "/DataURL", request));
- String data_url = response.encodeURL(data_URL.toString());
-
- request.setAttribute("local_request_url", local_request_url);
- request.setAttribute("data_url", data_url);
-
- return NULL_REQUEST_PAGE_JSP;
-
- // si.requests = new LocalRequest[holders_to_verify.size()];
- // si.response_properties = new Properties[si.requests.length];
- // si.current_operation = 0;
- // si.finished = false;
- //
- // request.getSession().setAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION,
- // si);
- // // SessionTable.put(si);
- //
- // LocalConnector local_conn = (LocalConnector)
- // ConnectorFactory.createConnector(si.connector);
- //
- // for (int i = 0; i < si.requests.length; i++)
- // {
- // SignatureHolder holder = (SignatureHolder) holders_to_verify.get(i);
- //
- // String text_to_be_verified = holder.getSignedText();
- // // Normalizer normalizer = new Normalizer();
- // // String normalized = normalizer.normalize(holder.signed_text);
- //
- // String request_string =
- // local_conn.prepareVerifyRequest(text_to_be_verified,
- // holder.getSignatureObject());
- //
- // LocalRequest local_request = new
- // LocalRequest(local_conn.getVerifyURL(holder.getSignatureObject().getSignationType()),
- // request_string);
- // si.requests[i] = local_request;
- // si.response_properties[i] = null;
- // }
- //
- // // ByteArrayOutputStream baos = new ByteArrayOutputStream();
- // // ObjectOutputStream oos = new ObjectOutputStream(baos);
- // // oos.writeObject(local_requests);
- // // oos.close();
- // // baos.close();
- //
- // // byte [] requests_bytes = baos.toByteArray();
- // // String base64 = CodingHelper.encodeBase64(requests_bytes);
- //
- // prepareDispatchToLocalConnectionPage(si.requests[0], request, response);
- }
-
- // what is this for?
-// /**
-// * Sets up the local verify procedure.
-// *
-// * @param response
-// * The HttpServletResponse the local request page is written to.
-// * @return Returns the JSP location where the calling servlet should dispatch
-// * to.
-// * @throws SignatureException
-// * Forwarded exception.
-// * @throws NormalizeException
-// * Forwarded exception.
-// * @throws IOException
-// * Forwarded exception.
-// * @throws ConnectorFactoryException
-// * Forwarded exception.
-// * @throws SettingsException Forwarded exception.
-// */
-// public static String processLocalVerifyForSingleSignature(VerifySessionInformation si, List holders_to_verify, HttpServletRequest request, HttpServletResponse response) throws SignatureException,
-// NormalizeException, IOException, ConnectorFactoryException, SettingsException
-// {
-// si.requests = new LocalRequest[1];
-// si.response_properties = new Properties[1];
-// si.current_operation = 0;
-// si.finished = false;
-//
-// String host = request.getServerName();
-// URL loc_ref_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/RetrieveSignatureData");
-// String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
-//
-// SignatureHolder holder = (SignatureHolder) holders_to_verify.get(0);
-//
-// SignatureObject s = holder.getSignatureObject();
-//
-// // TODO This whole processing is unnecessary here because only the mime type is used. - already deprecated
-// // String text_to_be_verified = holder.getSignedText();
-// SignatureData sd = null;
-//
-// if (holder.getSignatureObject().isBinary())
-// {
-// BinarySignatureHolder bsh = (BinarySignatureHolder) holder;
-// // byte[] data = CodingHelper.decodeBase64(text_to_be_verified);
-// sd = new SignatureDataImpl(bsh.getSignedPdf(), "application/pdf");
-// }
-// else
-// {
-// String text_to_be_verified = holder.getSignedText();
-// DataSource ds = new TextDataSourceImpl(text_to_be_verified);
-// sd = new SignatureDataImpl(ds, "text/plain", "UTF-8");
-// }
-//
-// SignSignatureObject so = SignatureObjectHelper.convertSignatureObjectToSignSignatureObject(s);
-//
-// LocalConnector local_conn = ConnectorChooser.chooseLocalConnectorForVerify(si.connector, s.getKZ(), so.id, si.type, loc_ref_url);
-// String request_string = local_conn.prepareVerifyRequest(sd, so);
-//
-// LocalRequest local_request = new LocalRequest("not-needed", request_string);
-// si.requests[0] = local_request;
-// si.response_properties[0] = null;
-//
-// // TODO read from config - already deprecated
-// String local_request_url = getLocalServiceAddress(si.type, si.connector);
-//
-// URL data_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/DataURL");
-// String data_url = response.encodeURL(data_URL.toString());
-//
-// request.setAttribute("local_request_url", local_request_url);
-// request.setAttribute("data_url", data_url);
-//
-// return NULL_REQUEST_PAGE_JSP;
-// }
-
- /**
- * Formats the OK response from the web application back to the local BKU.
- *
- * <p>
- * As stated in the BKU tutorial, this response must be plain text "<ok/>".
- * Otherwise BKU will assume a failure.
- * </p>
- *
- * @param response
- * The HttpServletResponse to answer to.
- * @throws IOException
- * Forwarded exception.
- */
- protected static void formatBKUOkResponse(HttpServletResponse response) throws IOException
- {
- response.setContentType("text/plain");
- response.setCharacterEncoding("ISO-8859-1");
-
- response.getWriter().println("<ok/>");
- }
-
- /**
- * Prepares the dispatch to the local data connection page.
- *
- * <p>
- * The calling servlet just has to dispatch to the jsp after calling this
- * method.
- * </p>
- *
- * @param local_request
- * The local request. Basically this contains the local service's
- * target URL and the XML request string.
- * @param response
- * The HttpServletResponse to write this page to.
- * @throws IOException
- * Forwarded exception.
- * @throws SignatureException
- * Forwarded exception.
- * @throws NormalizeException
- * Forwarded exception.
- */
- public static void prepareDispatchToLocalConnectionPage(LocalRequest local_request, HttpServletRequest request, HttpServletResponse response) throws IOException, SignatureException,
- NormalizeException
- {
- response.setContentType("text/html");
- response.setCharacterEncoding("UTF-8");
-
- String local_request_url = local_request.getUrl();
-
- String quoted_request = makeStringHTMLReady(local_request.getRequestString());
-
- String host = request.getServerName(); // "129.27.153.77"
- URL data_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/AsynchronousDataResponder");
- String data_url = response.encodeURL(data_URL.toString());
- URL redirect_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/AsynchronousRedirectResponder");
- String redirect_url = response.encodeURL(redirect_URL.toString());
-
- request.setAttribute("local_request_url", local_request_url);
- request.setAttribute("quoted_request", quoted_request);
- request.setAttribute("data_url", data_url);
- request.setAttribute("redirect_url", redirect_url);
- }
-
- public static String makeStringHTMLReady(String input)
- {
- String output = input;
-
- output = output.replaceAll("&", "&amp;");
- output = output.replaceAll("\"", "&quot;");
- output = output.replaceAll("<", "&lt;");
- output = output.replaceAll(">", "&gt;");
- return output;
- }
-
- public static String getLocalServerAddress(HttpServletRequest request, HttpServletResponse response)
- {
- String host = request.getServerName();
- URL local_server = null;
- try
- {
- String scheme = request.getScheme();
- int port = request.getServerPort();
- if ("http".equalsIgnoreCase(scheme) && port == 80) {
- local_server = new URL(scheme, host, "/");
- } else if ("https".equalsIgnoreCase(scheme) && port == 443) {
- local_server = new URL(scheme, host, "/");
- } else {
- local_server = new URL(scheme, host, port, "/");
- }
- }
- catch (MalformedURLException e)
- {
- logger.error(e.getMessage(), e);
- }
- String loc_server = response.encodeURL(local_server.toString());
-
- return loc_server;
- }
-
- public static String getLocalContextAddress(HttpServletRequest request, HttpServletResponse response) {
- String serverURL = getLocalServerAddress(request, response);
- String context = request.getContextPath();
- if (serverURL.endsWith("/") && context.startsWith("/")) {
- context = context.substring(1);
- }
- return serverURL + context;
- }
-
- /**
- * Returns the URL for accessing the local service.
- * <p>
- * This information is taken from the profile and if not defined from the
- * defaults.
- * </p>
- * <p>
- * E.g. http://127.0.0.1:3495/http-security-layer-request
- * </p>
- *
- * @param profile
- * The profile to take the data from.
- * @param device
- * The service device to be accessed. E.g. bku.
- * @return Returns the URL for accessing the local service.
- * @throws SettingsException F.e.
- */
- public static String getLocalServiceAddress(String profile, String device) throws SettingsException
- {
- SettingsReader settings = SettingsReader.getInstance();
-
- String url = getConnectorValueFromProfile(settings, profile, device + ".sign.url");
-
- return url; //"http://127.0.0.1:3495/http-security-layer-request";
- }
-
- /**
- * Reads the configuration entry given by the key, first from the given
- * profile, if not found from the defaults.
- *
- * @param settings
- * The settings.
- * @param profile
- * The profile.
- * @param key
- * The configuration key.
- * @return Returns the configuration entry.
- */
- public static String getConnectorValueFromProfile(SettingsReader settings,
- String profile, String key)
- {
- String value = settings.getValueFromKey("sig_obj." + profile + "." + key); //$NON-NLS-1$//$NON-NLS-2$
- if (value == null)
- {
- value = settings.getValueFromKey(key);
- }
- return value;
- }
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PDFContainer.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PDFContainer.java
deleted file mode 100644
index 6c9823c..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PDFContainer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package at.knowcenter.wag.egov.egiz.web;
-
-public class PDFContainer {
-
- public long id;
- public byte[] pdf;
-
-
- public PDFContainer(byte[] pdf, long id) {
- this.id = id;
- this.pdf = pdf;
- }
-
- public boolean equals(Object pc) {
- if(pc instanceof PDFContainer) {
- return (this.id == ((PDFContainer)pc).id);
- }
- return false;
- }
- public int hashCode() {
- Long l = new Long(this.id);
- return l.intValue();
- }
-
-}
-
-
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
deleted file mode 100644
index 32cfc1e..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: PdfASServletContextListener.java,v 1.3 2006/10/31 08:22:04 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-
-import at.gv.egiz.pdfas.api.commons.Constants;
-import at.gv.egiz.pdfas.utils.ConfigUtils;
-import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
-import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
-
-/**
- * The ServletContextListener is notified when the webapplication starts up and shuts down.
- *
- * <p>
- * Maintainance work is performed.
- * </p>
- *
- * @author wprinz
- */
-public class PdfASServletContextListener implements ServletContextListener
-{
- /**
- * The logger.
- */
- private static final Logger logger = ConfigLogger.getLogger(PdfASServletContextListener.class);
-
-
- /**
- * The servlet init parameter that may be used to declare the pdf-as configuration folder. The
- * init parameter may be set in web.xml or in META-INF/context.xml resp.
- * conf/Catalina/localhost/pdf-as.xml if deployed.
- */
- private final static String CONFIG_SERVLET_INIT_PARAMETER = "work-dir";
-
- /**
- * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
- */
- public void contextInitialized(ServletContextEvent sce)
- {
- logger.info("PDF-AS Context init"); //$NON-NLS-1$
-
- String sysPropWorkdir = System.getProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY);
- String scWorkdir = sce.getServletContext().getInitParameter(CONFIG_SERVLET_INIT_PARAMETER);
-
- String work_dir;
-
- // search for system property
- if (!StringUtils.isEmpty(sysPropWorkdir)) {
- work_dir = sysPropWorkdir;
- logger.debug("Work-dir configuration via system property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\" = \"" + sysPropWorkdir + "\".");
-
- // search for servlet parameter
- } else if (!StringUtils.isEmpty(scWorkdir)){
- work_dir = scWorkdir;
- logger.debug("Work-dir configuration via servlet init parameter \"" + CONFIG_SERVLET_INIT_PARAMETER + "\" = \"" + scWorkdir + "\".");
-
- // assume configuration to be located in webapp path
- } else {
- work_dir = sce.getServletContext().getRealPath("/");
- logger.info("PDF-AS work-dir not explicitely given. Assuming configuration is located in webapp folder \"" + work_dir + "\".");
- }
-
- logger.info("PDF-AS configuration location = \"" + work_dir + "\"");
-
-// try
-// {
-// logger.info("PDF-AS work directory = " + new File(work_dir).getCanonicalPath()); //$NON-NLS-1$
-// logger.info("PDF-AS base directory = " + new File(base_dir).getCanonicalPath()); //$NON-NLS-1$
-// }
-// catch (IOException e)
-// {
-// e.printStackTrace();
-// }
-
-
- SettingsReader.initializeForWeb(work_dir);
- ConfigUtils.initializeLogger();
- try {
- SettingsReader.getInstance();
- } catch (SettingsException e) {
- logger.error(e.getMessage(), e);
- }
-
- SettingsReader.clearTemporaryDirectory();
- }
-
- /**
- * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
- */
- public void contextDestroyed(ServletContextEvent sce)
- {
- SettingsReader.clearTemporaryDirectory();
- logger.info("PDF-AS Context exit"); //$NON-NLS-1$
- }
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java
deleted file mode 100644
index 1a7d90f..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: SessionAttributes.java,v 1.2 2006/08/25 17:06:11 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-/**
- * Helper class that provides constants for the session attributes.
- *
- * @author wprinz
- */
-public abstract class SessionAttributes
-{
-
- /**
- * The user name.
- */
- public static final String ATTRIBUTE_USER_NAME = "uname";
-
- /**
- * The user password.
- */
- public static final String ATTRIBUTE_USER_PASSWORD = "upass";
-
- /**
- * The attribute name under which the SessionInformation object is stored.
- *
- * <p>
- * The SessionInformation class contains type safe references to the objects.
- * </p>
- */
- public static final String ATTRIBUTE_SESSION_INFORMATION = "session_information";
-
- /**
- * The signed pdf document.
- */
- public static final String SIGNED_PDF_DOCUMENT = "at.gv.egiz.pdfas.web.SignSessionInformation:signedPDF";
-
- /**
- * The download URL for the signed pdf document.
- */
- public static final String DOWNLOAD_URL_FOR_SIGNED_PDF_DOCUMENT = "java.lang.String:downloadURL";
-
- /**
- * The notification url of an external webapplication.
- */
- public static final String PARENT_WEBAPP_REDIRECT_URL = "java.lang.String:parentWebAppRedirectURL";
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionInformation.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionInformation.java
deleted file mode 100644
index 3eb08f5..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionInformation.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
- *
- * This software is the confidential and proprietary information of Know-Center,
- * Graz, Austria. You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement you entered
- * into with Know-Center.
- *
- * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
- * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
- * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES.
- *
- * $Id: SessionInformation.java,v 1.2 2006/08/25 17:06:11 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Properties;
-
-import at.gv.egiz.pdfas.impl.output.FileBasedDataSink;
-import at.gv.egiz.pdfas.framework.input.PdfDataSource;
-import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
-
-import at.knowcenter.wag.egov.egiz.framework.SignResult;
-import at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation;
-import at.knowcenter.wag.egov.egiz.pdf.TablePos;
-
-/**
- * This class is a collection of various session parameters that are passed
- * between the servlets and jsps.
- *
- * <p>
- * The SessionInformation class contains type safe references to the objects.
- * </p>
- *
- * @author wprinz
- */
-public class SessionInformation implements Serializable
-{
-
- /**
- * SVUID.
- */
- private static final long serialVersionUID = -7413884936584659150L;
-
- // public long session_id = -1;
-
- /**
- * The connector.
- */
- public String connector = null;
-
- /**
- * For local requests, tells the application (sign, verify).
- */
- public String application = null;
-
- /**
- * Tells the operation mode (binary, textual).
- */
- public String mode = null;
-
- /**
- * The original, uploaded pdf.
- */
- //public byte[] pdf = null;
- public PdfDataSource pdfDataSource = null;
-
- /**
- * The type/profile of the signature.
- */
- public String type = null;
-
- /**
- * The user name.
- */
- public String user_name = null;
-
- /**
- * The password.
- */
- public String user_password = null;
-
- /**
- * An array of local requests to be processed.
- */
- public LocalRequest[] requests = null;
-
- /**
- * The index of the local request to be processed next.
- */
- public int current_operation = 0;
-
- /**
- * An array of response strings of the local requests.
- */
- public Properties[] response_properties = null;
-
- /**
- * Tells, if the current local request has been finished.
- */
- public boolean finished = false;
-
- /**
- * The incremental update information that has been extracted from the given
- * PDF document.
- */
- public IncrementalUpdateInformation iui;
-
- public SignatorInformation si = null;
-
- public FileBasedDataSink output = null;
-
- /**
- * The signature holders.
- */
- public List signature_holders;
-
- /**
- * Copy of signature holders. It's needed by BKU when we try to verify single by single
- * signature.
- */
- public List copy_of_signature_holders;
-
- /**
- * The suggested filename.
- */
- public String filename;
-
- /**
- * Tells, if the file download should be done inline or as attachment.
- */
- public boolean download_inline;
-
-// /**
-// * The sign result to be passed back to the user.
-// */
-// public SignResult sign_result;
-
- public boolean isSignFinished = false;
-
-
-
- /**
- * Object containing information about the calling webapplication.
- * @author: Thomas Zefferer
- */
- public ExternAppInformation exappinf;
-
- /**
- * Information about the signature position
- * @author: Thomas Zefferer
- */
- public TablePos pos ;
-
-}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionTable.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionTable.java
deleted file mode 100644
index 4d0ba21..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionTable.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- */
-package at.knowcenter.wag.egov.egiz.web;
-
-
-/**
- * This class contains the session table that is used for local requests.
- *
- * @author wprinz
- */
-public abstract class SessionTable
-{
- // Session table no longer needed - because J2EE Servlet sessions are used.
-
-// /**
-// * The HashMap for mapping the session id to the SessionInformation object on
-// * the server.
-// */
-// protected static Map session_table = new HashMap();
-//
-// /**
-// * The random number generator used to generate session_ids.
-// */
-// protected static Random random = new Random();
-//
-// /**
-// * Generates a new SessionInformation object with a unique session_id.
-// *
-// * <p>
-// * The object has to be added to the session table by using put().
-// * </p>
-// *
-// * @return Returns the generated SessionInformation object.
-// *
-// * @see #put(SessionInformation)
-// */
-// public static SessionInformation generateSessionInformationObject()
-// {
-// SessionInformation si = new SessionInformation();
-// si.session_id = random.nextLong();
-//
-// return si;
-// }
-//
-// /**
-// * Puts the SessionInformation object into the session table.
-// *
-// * @param si
-// * The SessionInformation object. The session_id field must be filled
-// * out properly.
-// */
-// public static void put(SessionInformation si)
-// {
-// session_table.put(new Long(si.session_id), si);
-// }
-//
-// /**
-// * Gets the SessionInformation object associated with the given session_id.
-// *
-// * @param session_id
-// * The session_id.
-// * @return Returns the corresponding SessionInformation object or null, if no
-// * object is associated with that id.
-// */
-// public static SessionInformation get(final long session_id)
-// {
-// return (SessionInformation) session_table.get(new Long(session_id));
-// }
-//
-// /**
-// * Removes the SessionInformation object with the provided session_id from the
-// * session table.
-// *
-// * @param session_id
-// * The session_id to be removed.
-// */
-// public static void remove(long session_id)
-// {
-// session_table.remove(new Long(session_id));
-// }
-//
-// /**
-// * Simply clear the session table.
-// *
-// * <p>
-// * This should be used once in a while to tie up some loose ends.
-// * </p>
-// */
-// public static void clear()
-// {
-// session_table.clear();
-// }
-}