From 29ad090c29567ff1a4d3a2ec9b8ad0b5d80ee24d Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 6 Dec 2010 16:34:52 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@671 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../egiz/pdfas/web/session/SessionAttributes.java | 62 +++++++ .../pdfas/web/session/SignSessionInformation.java | 154 ++++++++++++++++ .../web/session/VerifySessionInformation.java | 198 +++++++++++++++++++++ 3 files changed, 414 insertions(+) create mode 100644 pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SessionAttributes.java create mode 100644 pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java create mode 100644 pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/VerifySessionInformation.java (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SessionAttributes.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SessionAttributes.java new file mode 100644 index 0000000..3da6fa3 --- /dev/null +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SessionAttributes.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2006 by Know-Center, Graz, Austria + * + * 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.gv.egiz.pdfas.web.session; + +/** + * 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. + * + *

+ * The SessionInformation class contains type safe references to the objects. + *

+ */ + 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/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java new file mode 100644 index 0000000..94428a4 --- /dev/null +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java @@ -0,0 +1,154 @@ +/** + * + */ +package at.gv.egiz.pdfas.web.session; + +import java.io.Serializable; + +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.pdfas.api.internal.LocalBKUParams; +import at.gv.egiz.pdfas.api.io.DataSink; +import at.gv.egiz.pdfas.api.io.DataSource; +import at.gv.egiz.pdfas.api.sign.SignParameters; +import at.gv.egiz.pdfas.api.sign.SignResult; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; +import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; +import at.gv.egiz.pdfas.web.ExternAppInformation; +import at.gv.egiz.pdfas.web.LocalRequest; + +/** + * @author wprinz + * + */ +public class SignSessionInformation implements HttpSessionBindingListener, Serializable +{ + /** + * SVUID. + */ + private static final long serialVersionUID = 2739944460007369626L; + + /** + * The log. + */ + private static Log log = LogFactory.getLog(SignSessionInformation.class); + + /** + * 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 DataSource pdfDataSource = null; + + /** + * The type/profile of the signature. + */ + public String type = null; + + /** + * The suggested filename. + */ + public String filename; + + /** + * Tells, if the file download should be done inline or as attachment. + */ + public boolean download_inline; + + /** + * Object containing information about the calling webapplication. + * + * @author: Thomas Zefferer + */ + public ExternAppInformation exappinf; + + /** + * Information about the signature position + * + * @author exthex + */ + public SignaturePositioning pos; + + /** + * The SignatureDetailInformation. + */ + public SignatureDetailInformation sdi = null; + + /** + * The DataSink to write the output data to. + */ + public DataSink output = null; + + /** + * The local request to be sent to the device. + */ + public LocalRequest localRequest = null; + +// /** +// * The response properties of the local request. +// */ +// public Properties response_properties = null; + + /** + * Tells if the sign request has been processed and the signed document is + * available in the DataSink. + */ + public boolean outputAvailable = false; + + /** + * The SignParameters + */ + public SignParameters signParameters; + + public SignResult signResult; + + public byte[] signedPdf; + + public String xmlResponse; + + public LocalBKUParams localBKUParams; + + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent) + */ + public void valueBound(HttpSessionBindingEvent event) + { + log.debug("Bound SignSessionInformation to session (ID=" + event.getSession().getId() + ")."); + } + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent) + */ + public void valueUnbound(HttpSessionBindingEvent event) + { + log.debug("Unbound SignSessionInformation from session (ID=" + event.getSession().getId() + ")."); + + //TODO needed? +// if (this.pdfDataSource != null) +// { +// TempDirHelper.deleteDataSourceIfFileBased(this.pdfDataSource); +// } +// if (this.output != null) +// { +// TempDirHelper.deleteDataSinkIfFileBased(this.output); +// } + } +} diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/VerifySessionInformation.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/VerifySessionInformation.java new file mode 100644 index 0000000..bbaa647 --- /dev/null +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/VerifySessionInformation.java @@ -0,0 +1,198 @@ +/** + * Copyright (c) 2006 by Know-Center, Graz, Austria + * + * 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.gv.egiz.pdfas.web.session; + +import java.io.Serializable; + +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; +import at.gv.egiz.pdfas.api.io.DataSource; +import at.gv.egiz.pdfas.api.verify.VerifyResults; +import at.gv.egiz.pdfas.web.CurrentLocalOperation; +import at.gv.egiz.pdfas.web.ExternAppInformation; + +/** + * This class is a collection of various session parameters that are passed + * between the servlets and jsps. + * + *

+ * The SessionInformation class contains type safe references to the objects. + *

+ * + * @author wprinz + */ +public class VerifySessionInformation implements HttpSessionBindingListener, Serializable +{ + + /** + * SVUID. + */ + private static final long serialVersionUID = -7413884936584659150L; + + /** + * The log. + */ + private static Log log = LogFactory.getLog(VerifySessionInformation.class); + + /** + * 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 FileBasedPdfDataSourceImpl pdfDataSource = null; + public DataSource inputDataSource = 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; + +// /** +// * All SignatureHolders extracted from the document. +// */ +// public List signature_holders; + + /** + * Keeps track of the currently running local operation. + * + *

+ * Only valid during local verify. + *

+ */ + public CurrentLocalOperation currentLocalOperation = null; + +// /** +// * This is used only for MOA loc-ref web verify. +// */ +// public SignatureHolder moa_holder; + + +// /** +// * The incremental update information that has been extracted from the given +// * PDF document. +// */ +// public IncrementalUpdateInformation iui; + +// public SignatorInformation si = null; + +// public FileBasedDataSink output = null; + + +// /** +// * 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; + + public AnalyzeResult analyzeResult; + + public VerifyResults verifyResults; + +// /** +// * Information about the signature position +// * @author: Thomas Zefferer +// */ +// public TablePos pos ; + + + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent) + */ + public void valueBound(HttpSessionBindingEvent event) + { + log.debug("Bound SignSessionInformation to session."); + } + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent) + */ + public void valueUnbound(HttpSessionBindingEvent event) + { + log.debug("Unbound SignSessionInformation from session."); + + //TODO needed? +// if (this.inputDataSource != null) +// { +// TempDirHelper.deleteDataSourceIfFileBased(this.inputDataSource); +// } +// if (this.signature_holders != null) +// { +// Iterator it = this.signature_holders.iterator(); +// while (it.hasNext()) +// { +// SignatureHolder sh = (SignatureHolder) it.next(); +// TempDirHelper.deleteDataSourceIfFileBased(sh.getDataSource()); +// } +// } + } + +} -- cgit v1.2.3