aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/proxy
diff options
context:
space:
mode:
authorpeter.danner <peter.danner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-09-08 08:02:11 +0000
committerpeter.danner <peter.danner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-09-08 08:02:11 +0000
commit2613d3ab04f178be278189f209ef64d15ff94e9f (patch)
treef93377fd1122e2f14a99eb4aa84daf1020d0a95c /id.server/src/at/gv/egovernment/moa/id/proxy
parentf6a617e6820751fb5f941ff1019426fe2aa8ba4e (diff)
downloadmoa-id-spss-2613d3ab04f178be278189f209ef64d15ff94e9f.tar.gz
moa-id-spss-2613d3ab04f178be278189f209ef64d15ff94e9f.tar.bz2
moa-id-spss-2613d3ab04f178be278189f209ef64d15ff94e9f.zip
WebDAV Enhancement des Proxy
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@503 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/proxy')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java57
1 files changed, 40 insertions, 17 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java b/id.server/src/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java
index a1ccb7353..d6b21e6ff 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java
@@ -1,16 +1,18 @@
package at.gv.egovernment.moa.id.proxy;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import com.ibm.webdav.HTTPHeaders;
import com.ibm.webdav.protocol.URLStreamHandlerFactory;
-import java.util.StringTokenizer;
import com.ibm.webdav.protocol.http.WebDAVURLConnection;
+import java.util.StringTokenizer;
import java.net.URL;
+import java.net.URLEncoder;
import java.net.URLStreamHandler;
import java.util.Iterator;
-import java.util.Map;
+import java.util.Vector;
import javax.net.ssl.SSLSocketFactory;
import javax.servlet.http.HttpServletRequest;
@@ -77,7 +79,7 @@ public class ElakConnectionBuilder implements ConnectionBuilder {
String publicURLPrefix,
String realURLPrefix,
SSLSocketFactory sslSocketFactory,
- Map parameters)
+ Vector parameters)
throws IOException {
String requestedURL = req.getRequestURL().toString();
@@ -101,9 +103,10 @@ public class ElakConnectionBuilder implements ConnectionBuilder {
String query = req.getQueryString();
requestedURL = requestedURL + "?" + query;
- for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
- String parameterKey = (String) iter.next();
- if(query.indexOf(parameterKey) >= 0) iter.remove();
+ String parameter[] = new String[2];
+ for (Iterator iter = parameters.iterator(); iter.hasNext();) {
+ parameter = (String[]) iter.next();
+ if(query.indexOf(parameter[0]) >= 0) iter.remove();
}
}
@@ -188,24 +191,44 @@ public class ElakConnectionBuilder implements ConnectionBuilder {
}
return conn;
}
+
+ /**
+ * Disconnects the HttpURLConnection if necessary.
+ * The implementation of the Connectionbuilder decides wether
+ * if this should be happen or not.
+ *
+ * @param con the HttpURLConnection which is normaly to be closed
+ */
+ public void disconnect(HttpURLConnection conn) {
+ conn.disconnect();
+ }
+
/**
* @param requestedURL
* @param parameters
* @return
*/
- private String appendQueryString(String requestedURL, Map parameters) {
+ private String appendQueryString(String requestedURL, Vector parameters) {
String newURL = requestedURL;
- for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
- String paramName = (String)iter.next();
- String paramValue = (String)parameters.get(paramName);
- String paramString = paramName + "=" + paramValue;
- if (newURL.indexOf("?") < 0)
- newURL = newURL + "?" + paramString;
- else
- newURL = newURL + "&" + paramString;
- }
+ String parameter[] = new String[2];
+ String paramValue ="";
+ String paramName ="";
+ String paramString ="";
+ for (Iterator iter = parameters.iterator(); iter.hasNext();) {
+ try {
+ parameter = (String[]) iter.next();
+ //Following two lines do not work with OWA-SSL-Login-form
+ paramName = URLEncoder.encode((String) parameter[0], "UTF-8");
+ paramValue = URLEncoder.encode((String) parameter[1], "UTF-8");
+
+ } catch (UnsupportedEncodingException e) {
+ //UTF-8 should be supported
+ }
+ paramString = "&" + paramName + "=" + paramValue + paramString;
+ }
+ if (paramString.length()>0) newURL = newURL + "?" + paramString.substring(1);
return newURL;
- }
+ }
/**
* @author Stefan Knirsch