aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java24
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java12
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java9
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java6
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java8
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java2
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java3
-rw-r--r--pdf-as-web/src/main/resources/template_error_redirect.html2
-rw-r--r--pdf-as-web/src/main/resources/template_invoke_redirect.html2
9 files changed, 61 insertions, 7 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 b79075a1..8ec5d6fe 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
@@ -29,7 +29,6 @@ import java.awt.Image;
import java.awt.image.RenderedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@@ -54,10 +53,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.gv.egiz.pdfas.api.ws.PDFASSignParameters;
-import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse;
-import at.gv.egiz.pdfas.api.ws.VerificationLevel;
import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
+import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.lib.api.ByteArrayDataSink;
import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
@@ -109,11 +107,12 @@ public class PdfAsHelper {
private static final String PDF_VER_LEVEL = "PDF_VER_LEVEL";
private static final String PDF_VER_RESP = "PDF_VER_RESP";
private static final String PDF_INVOKE_URL = "PDF_INVOKE_URL";
+ private static final String PDF_INVOKE_TARGET = "PDF_INVOKE_TARGET";
private static final String REQUEST_FROM_DU = "REQ_DATA_URL";
private static final String SIGNATURE_DATA_HASH = "SIGNATURE_DATA_HASH";
private static final String SIGNATURE_ACTIVE = "SIGNATURE_ACTIVE";
private static final String VERIFICATION_RESULT = "VERIFICATION_RESULT";
-
+
private static final Logger logger = LoggerFactory
.getLogger(PdfAsHelper.class);
@@ -852,6 +851,23 @@ public class PdfAsHelper {
Object obj = session.getAttribute(PDF_INVOKE_URL);
return obj == null ? null : obj.toString();
}
+
+ public static void setInvokeTarget(HttpServletRequest request,
+ HttpServletResponse response, String url) {
+
+
+
+ HttpSession session = request.getSession();
+ session.setAttribute(PDF_INVOKE_TARGET, url);
+ logger.debug("External Invoke TARGET: " + url);
+ }
+
+ public static String getInvokeTarget(HttpServletRequest request,
+ HttpServletResponse response) {
+ HttpSession session = request.getSession();
+ Object obj = session.getAttribute(PDF_INVOKE_TARGET);
+ return obj == null ? null : obj.toString();
+ }
private static String generateURL(HttpServletRequest request,
HttpServletResponse response, String Servlet) {
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java
index 126b10ce..c2cee9c6 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java
@@ -33,11 +33,13 @@ public class PdfAsParameterExtractor {
public static final String PARAM_INVOKE_URL = "invoke-app-url";
+ public static final String PARAM_INVOKE_URL_TARGET = "invoke-app-url-target";
public static final String PARAM_INVOKE_URL_ERROR = "invoke-app-error-url";
public static final String PARAM_LOCALE = "locale";
public static final String PARAM_NUM_BYTES = "num-bytes";
public static final String PARAM_PDF_URL = "pdf-url";
public static final String PARAM_SIG_TYPE = "sig-type";
+ public static final String PARAM_SIG_TYPE_ALIAS = "sig_type";
public static final String PARAM_SIG_POS_P = "sig-pos-p";
public static final String PARAM_SIG_POS_Y = "sig-pos-y";
public static final String PARAM_SIG_POS_X = "sig-pos-x";
@@ -63,6 +65,10 @@ public class PdfAsParameterExtractor {
return (String)request.getAttribute(PARAM_INVOKE_URL);
}
+ public static String getInvokeTarget(HttpServletRequest request) {
+ return (String)request.getAttribute(PARAM_INVOKE_URL_TARGET);
+ }
+
public static String getInvokeErrorURL(HttpServletRequest request) {
String url = (String)request.getAttribute(PARAM_INVOKE_URL_ERROR);
return url;
@@ -81,7 +87,11 @@ public class PdfAsParameterExtractor {
}
public static String getSigType(HttpServletRequest request) {
- return (String)request.getAttribute(PARAM_SIG_TYPE);
+ String value = (String)request.getAttribute(PARAM_SIG_TYPE);
+ if(value == null) {
+ value = (String)request.getAttribute(PARAM_SIG_TYPE_ALIAS);
+ }
+ return value;
}
public static String getSigPosP(HttpServletRequest request) {
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java
index 5403c9ab..12693797 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java
@@ -92,6 +92,15 @@ public class ErrorPage extends HttpServlet {
String template = PdfAsHelper.getErrorRedirectTemplateSL();
template = template.replace("##ERROR_URL##",
errorURL);
+
+ String target = PdfAsHelper.getInvokeTarget(request, response);
+
+ if(target == null) {
+ target = "_self";
+ }
+
+ template = template.replace("##TARGET##", target);
+
if (e != null && WebConfiguration.isShowErrorDetails()) {
template = template.replace("##CAUSE##",
URLEncoder.encode(e.getMessage(), "UTF-8"));
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
index f3c3fcca..fb633bd5 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
@@ -93,6 +93,9 @@ public class ExternSignServlet extends HttpServlet {
String invokeUrl = PdfAsParameterExtractor.getInvokeURL(request);
PdfAsHelper.setInvokeURL(request, response, invokeUrl);
+ String invokeTarget = PdfAsParameterExtractor.getInvokeTarget(request);
+ PdfAsHelper.setInvokeTarget(request, response, invokeTarget);
+
String pdfUrl = PdfAsParameterExtractor.getPdfUrl(request);
if (pdfUrl == null) {
@@ -244,6 +247,9 @@ public class ExternSignServlet extends HttpServlet {
String invokeUrl = PdfAsParameterExtractor.getInvokeURL(request);
PdfAsHelper.setInvokeURL(request, response, invokeUrl);
+ String invokeTarget = PdfAsParameterExtractor.getInvokeTarget(request);
+ PdfAsHelper.setInvokeTarget(request, response, invokeTarget);
+
String errorUrl = PdfAsParameterExtractor.getInvokeErrorURL(request);
PdfAsHelper.setErrorURL(request, response, errorUrl);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java
index 82bbc34f..1ee96602 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java
@@ -104,6 +104,14 @@ public class ProvidePDFServlet extends HttpServlet {
throw new PdfAsException("No Signature data available");
}
+ String target = PdfAsHelper.getInvokeTarget(request, response);
+
+ if(target == null) {
+ target = "_self";
+ }
+
+ template = template.replace("##TARGET##", target);
+
template = template.replace("##PDFURL##",
URLEncoder.encode(PdfAsHelper.generatePdfURL(request, response),
"UTF-8"));
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
index 3ff6eb09..40a8d590 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
@@ -90,6 +90,8 @@ public class UIEntryPointServlet extends HttpServlet {
String invokeUrl = pdfAsRequest.getParameters().getInvokeURL();
PdfAsHelper.setInvokeURL(req, resp, invokeUrl);
+ // TODO: Generate attribute for Invoke Target
+
String errorUrl = pdfAsRequest.getParameters().getInvokeErrorURL();
PdfAsHelper.setErrorURL(req, resp, errorUrl);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
index 83abdf2d..aa93f7c9 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
@@ -86,6 +86,9 @@ public class VerifyServlet extends HttpServlet {
String invokeUrl = PdfAsParameterExtractor.getInvokeURL(request);
PdfAsHelper.setInvokeURL(request, response, invokeUrl);
+ String invokeTarget = PdfAsParameterExtractor.getInvokeTarget(request);
+ PdfAsHelper.setInvokeTarget(request, response, invokeTarget);
+
String pdfUrl = PdfAsParameterExtractor.getPdfUrl(request);
if (pdfUrl == null) {
diff --git a/pdf-as-web/src/main/resources/template_error_redirect.html b/pdf-as-web/src/main/resources/template_error_redirect.html
index dd3f9d46..b5ca858d 100644
--- a/pdf-as-web/src/main/resources/template_error_redirect.html
+++ b/pdf-as-web/src/main/resources/template_error_redirect.html
@@ -42,7 +42,7 @@ div.content {
<div class="frameT">
<div class="frameTC">
<div class="content">
- <form name="CustomizedForm" action="##ERROR_URL##" method="GET">
+ <form name="CustomizedForm" action="##ERROR_URL##" method="GET" target="##TARGET##">
<input type="submit" value="Weiter"
name="Senden"> <input type="hidden"
name="cause" value="##CAUSE##"> <input
diff --git a/pdf-as-web/src/main/resources/template_invoke_redirect.html b/pdf-as-web/src/main/resources/template_invoke_redirect.html
index 0f98ffbb..fcd75008 100644
--- a/pdf-as-web/src/main/resources/template_invoke_redirect.html
+++ b/pdf-as-web/src/main/resources/template_invoke_redirect.html
@@ -42,7 +42,7 @@ div.content {
<div class="frameT">
<div class="frameTC">
<div class="content">
- <form name="CustomizedForm" action="##INVOKE_URL##" method="GET">
+ <form name="CustomizedForm" action="##INVOKE_URL##" method="GET" target="##TARGET##">
<input type="submit" value="Weiter"
name="Senden">
<input type="hidden" name="pdfurl" value="##PDFURL##">