summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
authorbschnalzer <bianca.schnalzer@egiz.gv.at>2017-05-02 08:37:41 +0200
committerbschnalzer <bianca.schnalzer@egiz.gv.at>2017-05-02 08:37:41 +0200
commite57fc49cfa7cb5e61fa1006370a4f9f156358aac (patch)
treea55bb76c54167e673f052bcd080f561cba224a0a /pdf-over-gui/src
parentef822ed5844d263d12d70d1e97b758ef8c0fd107 (diff)
downloadpdf-over-e57fc49cfa7cb5e61fa1006370a4f9f156358aac.tar.gz
pdf-over-e57fc49cfa7cb5e61fa1006370a4f9f156358aac.tar.bz2
pdf-over-e57fc49cfa7cb5e61fa1006370a4f9f156358aac.zip
Change CookieSpecs for IAIK ServerBKU
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
index 74a5516b..427afad5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
@@ -19,6 +19,7 @@ package at.asit.pdfover.gui.bku;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.http.client.config.CookieSpecs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +37,9 @@ public class BKUHelper {
/**
* Get a HTTP Client instance
- * @param useProxy whether to use a potentially set proxy
+ *
+ * @param useProxy
+ * whether to use a potentially set proxy
* @return the HttpClient
*/
public static HttpClient getHttpClient(boolean useProxy) {
@@ -44,15 +47,20 @@ public class BKUHelper {
client.getParams().setParameter("http.useragent", //$NON-NLS-1$
Constants.USER_AGENT_STRING);
+ client.getParams().setParameter("http.protocol.cookie-policy", CookieSpecs.BROWSER_COMPATIBILITY);
+
if (useProxy) {
- String host = System.getProperty("http.proxyHost"); //$NON-NLS-1$
- String port = System.getProperty("http.proxyPort"); //$NON-NLS-1$
- if (host != null && !host.isEmpty() &&
- port != null && !port.isEmpty()) {
+ String host = System.getProperty("http.proxyHost");
+ // $NON-NLS-1$
+ String port = System.getProperty("http.proxyPort");
+ // $NON-NLS-1$
+ if (host != null && !host.isEmpty() && port != null && !port.isEmpty()) {
int p = Integer.parseInt(port);
client.getHostConfiguration().setProxy(host, p);
- String user = System.getProperty("http.proxyUser"); //$NON-NLS-1$
- String pass = System.getProperty("http.proxyPassword"); //$NON-NLS-1$
+ String user = System.getProperty("http.proxyUser");
+ // $NON-NLS-1$
+ String pass = System.getProperty("http.proxyPassword");
+ // $NON-NLS-1$
if (user != null && !user.isEmpty() && pass != null) {
client.getState().setProxyCredentials(new AuthScope(host, p),
new UsernamePasswordCredentials(user, pass));
@@ -63,8 +71,9 @@ public class BKUHelper {
return client;
}
- /**
+ /**
* Get a HTTP Client instance
+ *
* @return the HttpClient
*/
public static HttpClient getHttpClient() {