aboutsummaryrefslogtreecommitdiff
path: root/id.server
diff options
context:
space:
mode:
Diffstat (limited to 'id.server')
-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