From 9e7979b3b06e5d91078a3cd144080e960b65d6a8 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Thu, 13 Oct 2011 16:37:57 +0000 Subject: Added support of mobile signature (test mode) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@864 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/web/servlets/SignServlet.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'pdf-as-web/src') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java index dcc0bb2..94c8cd0 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java @@ -49,8 +49,8 @@ import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.Log; import at.gv.egiz.pdfas.api.commons.Constants; import at.gv.egiz.pdfas.api.exceptions.PdfAsException; @@ -63,6 +63,7 @@ import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException; import at.gv.egiz.pdfas.web.ExternAppInformation; import at.gv.egiz.pdfas.web.FormFields; import at.gv.egiz.pdfas.web.helper.ApiHelper; +import at.gv.egiz.pdfas.web.helper.SessionHelper; import at.gv.egiz.pdfas.web.helper.SignServletHelper; import at.gv.egiz.pdfas.web.helper.WebSettingsReader; import at.gv.egiz.pdfas.web.helper.WebUtils; @@ -98,6 +99,8 @@ public class SignServlet extends HttpServlet private static Log log = LogFactory.getLog(SignServlet.class); private static Log statLog = LogFactory.getLog("statistic"); + + public static final String SUBMITFORM_SIGNATURE_TYPE_KEY = "signupload.jsp:signatureType"; public static final String SUBMITFORM_SIGNATURE_MODE_KEY = "signupload.jsp:signatureMode"; public static final String SUBMITFORM_SIGNATURE_DEVICE_KEY = "signupload.jsp:signatureKey"; @@ -109,11 +112,15 @@ public class SignServlet extends HttpServlet public static final String SUBMITFORM_FILENAME_KEY = "signupload.jsp:filenameKey"; public static final String SUBMITFORM_PREVIEW = "signupload.jsp:previewKey"; + + //Added by rpiazzi to know if an error occured within IFrame because this calls for //a different display of the error public static final String ERROR_WITHIN_IFRAME = "error_within_iframe"; //Added by rpiazzi to know the height of the div's in further jsp's public static final String HEIGHT_SIGN_DIV = "height_sign_div"; + //Added by rpiazzi + public static HttpSession session = null; protected void dispatch(HttpServletRequest request, HttpServletResponse response, String resource) throws ServletException, IOException { @@ -289,6 +296,12 @@ public class SignServlet extends HttpServlet SignSessionInformation si = new SignSessionInformation(); // SessionTable.generateSessionInformationObject(); si.connector = ud.sig_app; + + if ((request.getContextPath().startsWith("/test-")) && (si.connector.equals("mobile"))) { + si.connector = Constants.SIGNATURE_DEVICE_MOBILETEST; + session.setAttribute(SignServlet.SUBMITFORM_SIGNATURE_DEVICE_KEY, si.connector); + } + si.application = "sign"; si.mode = ud.sig_mode; si.pdfDataSource = ud.pdfDataSource; @@ -305,8 +318,6 @@ public class SignServlet extends HttpServlet si.pos = sigpos; // end add - HttpSession session = request.getSession(); - //added by rpiazzi to change signature block with/without note if (si.note) { if (si.type.equals(FormFields.VALUE_SIGNATURE_TYPE_DE)) { @@ -409,7 +420,7 @@ public class SignServlet extends HttpServlet Iterator it = items.iterator(); - HttpSession session = request.getSession(); + session = request.getSession(true); -- cgit v1.2.3