From 7d9e6231105818b86bf475d3d04db59ae3937b11 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Mon, 24 Oct 2011 17:07:46 +0000 Subject: Set request.getSession(true), so that if there is still an old session, but a new one is required git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@876 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/web/servlets/SignServlet.java | 41 +++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-) 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 2856a7d..a051396 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 @@ -222,9 +222,6 @@ public class SignServlet extends HttpServlet log.debug("No signature position provided."); } - if (note.equals("true")) { - sig_type = sig_type + "_NOTE"; - } // fixed by tknall: if we already have parameters "&" must be used instead of "?" String paramSeparator = (pdf_url.indexOf("?") != -1) ? "&" : "?"; @@ -251,13 +248,21 @@ public class SignServlet extends HttpServlet ud_extern.sig_mode = sig_mode; ud_extern.sig_type = sig_type; - if (note.equals("true")) { - ud_extern.note=true; + if (note!=null) { + if (note.equals("true")) { + ud_extern.note=true; + ud_extern.sig_type = ud_extern.sig_type + "_NOTE"; + } + else { + ud_extern.note=false; + } } else { - ud_extern.note=false; + ud_extern.note=true; + ud_extern.sig_type = ud_extern.sig_type + "_NOTE"; } - ud_extern.note = true; + + ud_extern.pdfa = false; ud = ud_extern; @@ -332,7 +337,7 @@ public class SignServlet extends HttpServlet } try { - HttpSession session = request.getSession(); + HttpSession session = request.getSession(true); // not needed, that is done in sign() // ud.pdfDataSource = PdfAS.applyStrictMode(ud.pdfDataSource); @@ -360,19 +365,6 @@ public class SignServlet extends HttpServlet si.pos = sigpos; // end add - //added by rpiazzi to change signature block with/without note - if ((si.note) && (!si.type.contains("NOTE"))) { - if (si.type.equals(FormFields.VALUE_SIGNATURE_TYPE_DE)) { - si.type = "SIGNATURBLOCK_DE_NOTE"; - session.setAttribute(SUBMITFORM_SIGNATURE_TYPE_KEY, si.type); - } - else { - si.type = "SIGNATURBLOCK_EN_NOTE"; - session.setAttribute(SUBMITFORM_SIGNATURE_TYPE_KEY, si.type); - } - } - //End added - log.info("Putting signature data into session " + session.getId()); session.setAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION, si); @@ -741,6 +733,13 @@ public class SignServlet extends HttpServlet ud.pdfDataSource = pdfDataSource; ud.note = noteEnabled; + //Added by rpiazzi + if (ud.note && !ud.sig_type.contains("NOTE")) { + ud.sig_type += "_NOTE"; + session.setAttribute(SUBMITFORM_SIGNATURE_TYPE_KEY, ud.sig_type); + } + //end added + return ud; } -- cgit v1.2.3