From 60f82132f019531586d4129f6eb374af08c04858 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Mon, 23 Jan 2012 11:13:50 +0000 Subject: Added passing form field checkbox for choosing mobile test app on test-pdf-as (test app) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@902 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/web/servlets/SignServlet.java | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'pdf-as-web/src/main/java') 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 a051396..1c594dd 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 @@ -338,13 +338,13 @@ public class SignServlet extends HttpServlet try { HttpSession session = request.getSession(true); -// not needed, that is done in sign() -// ud.pdfDataSource = PdfAS.applyStrictMode(ud.pdfDataSource); + // not needed, that is done in sign() + // ud.pdfDataSource = PdfAS.applyStrictMode(ud.pdfDataSource); SignSessionInformation si = new SignSessionInformation(); // SessionTable.generateSessionInformationObject(); si.connector = ud.sig_app; - if ((request.getContextPath().startsWith("/test-")) && (si.connector.equals("mobile"))) { + if ((ud.mobileTestEnabled) && (si.connector.equals("mobile"))) { si.connector = Constants.SIGNATURE_DEVICE_MOBILETEST; session.setAttribute(SignServlet.SUBMITFORM_SIGNATURE_DEVICE_KEY, si.connector); } @@ -451,7 +451,7 @@ public class SignServlet extends HttpServlet String mode=""; String doc_file_name; DataSource pdfDataSource; - + boolean mobileTestEnabled=false; Iterator it = items.iterator(); session = request.getSession(true); @@ -531,7 +531,7 @@ public class SignServlet extends HttpServlet if (item.isFormField()) { String item_string = item.getString("UTF-8"); //$NON-NLS-1$ - log.debug(" form field string = " + item_string); //$NON-NLS-1$ + log.debug(" form field string = " + item_string); //$NON-NLS-1$ } else { @@ -645,6 +645,15 @@ public class SignServlet extends HttpServlet } //end added + if (FormFields.FIELD_MOBILETEST_ENABLED.equals(item.getFieldName())) { + if (item.getString("UTF-8")!=null) { + if (item.getString("UTF-8").equals("on")) { + mobileTestEnabled=true; + } + } + continue; + } + throw new ServletException("Unrecognized POST data."); //$NON-NLS-1$ } @@ -738,6 +747,11 @@ public class SignServlet extends HttpServlet ud.sig_type += "_NOTE"; session.setAttribute(SUBMITFORM_SIGNATURE_TYPE_KEY, ud.sig_type); } + + if (mobileTestEnabled) { + ud.mobileTestEnabled=true; + } + //end added return ud; @@ -868,6 +882,8 @@ public class SignServlet extends HttpServlet protected DataSource pdfDataSource = null; + protected boolean mobileTestEnabled = false; + //added by rpiazzi protected boolean note = false; // protected byte[] pdf = null; -- cgit v1.2.3