aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main/java/at')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java5
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java56
2 files changed, 38 insertions, 23 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
index 1fffb17d..81b60131 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
@@ -39,6 +39,7 @@ import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
public class WebConfiguration implements IConfigurationConstants {
public static final String PUBLIC_URL = "public.url";
+ public static final String PUBLIC_DATA_URL = "public.data.url";
public static final String LOCAL_BKU_ENABLED = "bku.sign.enabled";
public static final String ONLINE_BKU_ENABLED = "moc.sign.enabled";
public static final String MOBILE_BKU_ENABLED = "mobile.sign.enabled";
@@ -226,6 +227,10 @@ public class WebConfiguration implements IConfigurationConstants {
return properties.getProperty(PUBLIC_URL);
}
+ public static String getPublicDataURL() {
+ return properties.getProperty(PUBLIC_DATA_URL);
+ }
+
public static String getLocalBKUURL() {
if(getLocalBKUEnabled()) {
String overwrite = properties.getProperty(CONFIG_BKU_URL);
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 8b98a322..9900dda4 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
@@ -1363,29 +1363,35 @@ public class PdfAsHelper {
private static String generateURL(HttpServletRequest request,
HttpServletResponse response, String Servlet) {
- HttpSession session = request.getSession();
- String publicURL = WebConfiguration.getPublicURL();
- String dataURL = null;
- if (publicURL != null) {
- dataURL = publicURL + Servlet + ";jsessionid=" + session.getId();
- } else {
- if ((request.getScheme().equals("http") && request.getServerPort() == 80)
- || (request.getScheme().equals("https") && request
- .getServerPort() == 443)) {
- dataURL = request.getScheme() + "://" + request.getServerName()
- + request.getContextPath() + Servlet + ";jsessionid="
- + session.getId();
- } else {
- dataURL = request.getScheme() + "://" + request.getServerName()
- + ":" + request.getServerPort()
- + request.getContextPath() + Servlet + ";jsessionid="
- + session.getId();
- }
- }
- log.debug("Generated URL: " + dataURL);
- return dataURL;
+ return generateURL(request, response, Servlet, WebConfiguration.getPublicURL());
+
}
+ private static String generateURL(HttpServletRequest request,
+ HttpServletResponse response, String Servlet, String publicURL) {
+ HttpSession session = request.getSession();
+ String dataURL = null;
+ if (publicURL != null) {
+ dataURL = publicURL + Servlet + ";jsessionid=" + session.getId();
+ } else {
+ if ((request.getScheme().equals("http") && request.getServerPort() == 80)
+ || (request.getScheme().equals("https") && request
+ .getServerPort() == 443)) {
+ dataURL = request.getScheme() + "://" + request.getServerName()
+ + request.getContextPath() + Servlet + ";jsessionid="
+ + session.getId();
+ } else {
+ dataURL = request.getScheme() + "://" + request.getServerName()
+ + ":" + request.getServerPort()
+ + request.getContextPath() + Servlet + ";jsessionid="
+ + session.getId();
+ }
+ }
+ log.debug("Generated URL: " + dataURL);
+ return dataURL;
+ }
+
+
public static void regenerateSession(HttpServletRequest request) {
request.getSession(false).invalidate();
request.getSession(true);
@@ -1393,12 +1399,16 @@ public class PdfAsHelper {
public static String generateDataURLSL20(HttpServletRequest request,
HttpServletResponse response) {
- return generateURL(request, response, PDF_SL20_DATAURL_PAGE);
+ return generateURL(request, response, PDF_SL20_DATAURL_PAGE,
+ WebConfiguration.getPublicDataURL() != null
+ ? WebConfiguration.getPublicDataURL() : WebConfiguration.getPublicURL());
}
public static String generateDataURL(HttpServletRequest request,
HttpServletResponse response) {
- return generateURL(request, response, PDF_DATAURL_PAGE);
+ return generateURL(request, response, PDF_DATAURL_PAGE,
+ WebConfiguration.getPublicDataURL() != null
+ ? WebConfiguration.getPublicDataURL() : WebConfiguration.getPublicURL());
}
public static String generateProvideURL(HttpServletRequest request,