aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ErrorPage.java3
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java2
-rw-r--r--pdf-as-web/src/main/resources/template_error.html16
-rw-r--r--pdf-as-web/src/main/resources/template_provide.html21
4 files changed, 41 insertions, 1 deletions
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 670756de..2afc811c 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
@@ -55,6 +55,7 @@ public class ErrorPage extends HttpServlet {
private static final String ERROR_STACK = "##ERROR_STACK##";
private static final String ERROR_MESSAGE = "##ERROR_MESSAGE##";
+ private static final String PUBLIC_URL = "##PUBLICURL##";
/**
* @see HttpServlet#HttpServlet()
@@ -164,6 +165,8 @@ public class ErrorPage extends HttpServlet {
template = template.replace(ERROR_STACK, "");
}
+ template = template.replace(PUBLIC_URL, WebConfiguration.getPublicURL());
+
response.setContentType("text/html");
response.getWriter().write(template);
response.getWriter().close();
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 7909e926..8a23b132 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
@@ -50,6 +50,7 @@ public class ProvidePDFServlet extends HttpServlet {
.getLogger(ProvidePDFServlet.class);
private static final String PDF_DATA_URL = "##PDFDATAURL##";
+ private static final String PUBLIC_URL = "##PUBLICURL##";
/**
* @see HttpServlet#HttpServlet()
@@ -89,6 +90,7 @@ public class ProvidePDFServlet extends HttpServlet {
String template = PdfAsHelper.getProvideTemplate();
template = template.replace(PDF_DATA_URL, PdfAsHelper.generatePdfURL(request, response));
+ template = template.replace(PUBLIC_URL, WebConfiguration.getPublicURL());
// Deliver to Browser directly!
response.setContentType("text/html");
response.getWriter().write(template);
diff --git a/pdf-as-web/src/main/resources/template_error.html b/pdf-as-web/src/main/resources/template_error.html
index 0371c568..87992c42 100644
--- a/pdf-as-web/src/main/resources/template_error.html
+++ b/pdf-as-web/src/main/resources/template_error.html
@@ -7,5 +7,21 @@
Error Page:
<p>##ERROR_MESSAGE##</p>
<p>##ERROR_STACK##</p>
+<script type="text/javascript">
+ try {
+ var data = {
+ pdfas: {
+ error: true,
+ msg: "##ERROR_MESSAGE##"
+ }
+ }
+
+ parent.postMessage(data, '##PUBLICURL##');
+ } catch(error) {
+ if(window.console) {
+ window.console.log("Sending message failed!", error);
+ }
+ }
+</script>
</body>
</html>
diff --git a/pdf-as-web/src/main/resources/template_provide.html b/pdf-as-web/src/main/resources/template_provide.html
index 8016be07..1ff00d15 100644
--- a/pdf-as-web/src/main/resources/template_provide.html
+++ b/pdf-as-web/src/main/resources/template_provide.html
@@ -1 +1,20 @@
-##PDFDATAURL## \ No newline at end of file
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="de">
+<head>
+<title>Provide PDF</title>
+</head>
+<body>
+PDF ready @: <a href="##PDFDATAURL##">download here</a>
+
+<script type="text/javascript">
+ var data = {
+ pdfas: {
+ success: true,
+ pdfUrl: "Child URL"
+ }
+ }
+
+ parent.postMessage(data, '##PUBLICURL##');
+</script>
+</body>
+</html>