aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-09 15:27:50 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-09 15:27:50 +0000
commiteb68e29e371ef3e944f682239e6f3f92cb084697 (patch)
tree39ef4547a7efe4e929886b3d2ca01bb037cb2ce4 /src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
parentdef55a4c6f4a26b8ddbf2a9e892e36a67d9380f1 (diff)
downloadpdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.tar.gz
pdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.tar.bz2
pdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.zip
Web-Application: Configuration may be declared via system property "pdf-as.work-dir" or via Servlet-Init-Parameter "work-dir".
Bug fixed in RetrieveSignatureDataServlet: Response header didn't contain a content length attribute. The ITS Mac BKU rejects those requests. Workaround for ITS Mac BKU integrated. A redirect via response does only work if the response contains a valid SL request (e.g. a NullOperationRequest). API: The configuration folder may be omitted at instantiating the api. Configuration may be set via system property "pdf-as.work-dir". If no configuration is given at all, the current user's home directory is searched for a folder "PDF-AS". If not found a default configuration is created. If the configuration is explicitely given than the temporary folder is located within the given directory otherwise within the user's temporary directory. Declaring the configuration folder, replacements for system properties like "${catalina.base}/conf/pdfas" may be used. Web-Application: Session is now being invalidated after download of the signed pdf file. Web-Application: Every hardcoded context "pdf-as" has been replaced. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@277 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
index 8ee09dc..2f02944 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java
@@ -84,7 +84,7 @@ public abstract class LocalRequestHelper
public static String processLocalSign(SignSessionInformation si, HttpServletRequest request, HttpServletResponse response) throws IOException, PresentableException
{
String host = request.getServerName(); // "129.27.153.77"
- URL loc_ref_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/RetrieveSignatureData");
+ URL loc_ref_URL = new URL(getLocalContextAddress(request, response) + "/RetrieveSignatureData");
String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
LocalConnector c = ConnectorChooser.chooseLocalConnectorForSign(si.connector, si.type, loc_ref_url);
@@ -175,7 +175,7 @@ public abstract class LocalRequestHelper
// si.finished = false;
String host = request.getServerName();
- URL loc_ref_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/RetrieveSignatureData");
+ URL loc_ref_URL = new URL(getLocalContextAddress(request, response) + "/RetrieveSignatureData");
String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
for (int i = 0; i < si.currentLocalOperation.requests.length; i++)
@@ -414,7 +414,15 @@ public abstract class LocalRequestHelper
URL local_server = null;
try
{
- local_server = new URL(request.getScheme(), host, request.getServerPort(), "/");
+ String scheme = request.getScheme();
+ int port = request.getServerPort();
+ if ("http".equalsIgnoreCase(scheme) && port == 80) {
+ local_server = new URL(scheme, host, "/");
+ } else if ("https".equalsIgnoreCase(scheme) && port == 443) {
+ local_server = new URL(scheme, host, "/");
+ } else {
+ local_server = new URL(scheme, host, port, "/");
+ }
}
catch (MalformedURLException e)
{
@@ -424,6 +432,15 @@ public abstract class LocalRequestHelper
return loc_server;
}
+
+ public static String getLocalContextAddress(HttpServletRequest request, HttpServletResponse response) {
+ String serverURL = getLocalServerAddress(request, response);
+ String context = request.getContextPath();
+ if (serverURL.endsWith("/") && context.startsWith("/")) {
+ context = context.substring(1);
+ }
+ return serverURL + context;
+ }
/**
* Returns the URL for accessing the local service.