aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-18 09:25:47 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-18 09:29:23 +0100
commit3d7d82dae1642a01dac69cf550ccdcb6b571357c (patch)
tree710c5ab409ad732549f2450f11b42f4e3a3bac9f /pdf-as-web/src/main
parent016599b6192cdc83d799cb55b346b2f40c426a57 (diff)
downloadpdf-as-4-3d7d82dae1642a01dac69cf550ccdcb6b571357c.tar.gz
pdf-as-4-3d7d82dae1642a01dac69cf550ccdcb6b571357c.tar.bz2
pdf-as-4-3d7d82dae1642a01dac69cf550ccdcb6b571357c.zip
Fixed PDF-AS Web Page parameters problem
Signed-off-by: Andreas Fitzek <andreas.fitzek@iaik.tugraz.at>
Diffstat (limited to 'pdf-as-web/src/main')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 13e8159f..607c6228 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -164,13 +164,17 @@ public class PdfAsHelper {
if (posP != null) {
if (!(posP.equals("auto") || posP.equals("new"))) {
- throw new PdfAsWebException(
- PdfAsParameterExtractor.PARAM_SIG_POS_P
- + " has invalid value! (auto | new )");
+ try {
+ Integer.parseInt(posP);
+ } catch (NumberFormatException e) {
+ throw new PdfAsWebException(
+ PdfAsParameterExtractor.PARAM_SIG_POS_P
+ + " has invalid value! (auto | new )");
+ }
}
sb.append("p:" + posP.trim() + ";");
} else {
- sb.append("P:auto;");
+ sb.append("p:auto;");
}
return sb.toString();
@@ -284,7 +288,7 @@ public class PdfAsHelper {
HttpSession session = request.getSession();
logger.info("Starting signature in session: " + session.getId());
-
+
Configuration config = pdfAs.getConfiguration();
session.setAttribute(PDF_CONFIG, config);
@@ -354,10 +358,11 @@ public class PdfAsHelper {
StatusRequest statusRequest = (StatusRequest) session
.getAttribute(PDF_STATUS);
- if(statusRequest == null) {
- throw new PdfAsWebException("No Signature running in session:" + session.getId());
+ if (statusRequest == null) {
+ throw new PdfAsWebException("No Signature running in session:"
+ + session.getId());
}
-
+
statusRequest.setCertificate(getCertificate(infoboxReadResponseType));
statusRequest = pdfAs.process(statusRequest);
session.setAttribute(PDF_STATUS, statusRequest);
@@ -376,10 +381,11 @@ public class PdfAsHelper {
StatusRequest statusRequest = (StatusRequest) session
.getAttribute(PDF_STATUS);
- if(statusRequest == null) {
- throw new PdfAsWebException("No Signature running in session:" + session.getId());
+ if (statusRequest == null) {
+ throw new PdfAsWebException("No Signature running in session:"
+ + session.getId());
}
-
+
statusRequest.setSigature(createCMSSignatureResponseType
.getCMSSignature());
statusRequest = pdfAs.process(statusRequest);
@@ -387,10 +393,11 @@ public class PdfAsHelper {
PdfAsHelper.process(request, response, context);
}
-
+
public static void logAccess(HttpServletRequest request) {
HttpSession session = request.getSession();
- logger.debug("Access to " + request.getServletPath() + " in Session: " + session.getId());
+ logger.debug("Access to " + request.getServletPath() + " in Session: "
+ + session.getId());
}
public static void process(HttpServletRequest request,
@@ -630,7 +637,7 @@ public class PdfAsHelper {
logger.info("Generated URL: " + dataURL);
return dataURL;
}
-
+
public static void regenerateSession(HttpServletRequest request) {
request.getSession(false).invalidate();
request.getSession(true);