summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java39
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java2
3 files changed, 27 insertions, 16 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 20cc04bb..765a6706 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
@@ -36,28 +36,39 @@ public class BKUHelper {
/**
* Get a HTTP Client instance
+ * @param useProxy whether to use a potentially set proxy
* @return the HttpClient
*/
- public static HttpClient getHttpClient() {
+ public static HttpClient getHttpClient(boolean useProxy) {
HttpClient client = new HttpClient();
client.getParams().setParameter("http.useragent", //$NON-NLS-1$
Constants.USER_AGENT_STRING);
-
- 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$
- if (user != null && !user.isEmpty() && pass != null) {
- client.getState().setProxyCredentials(new AuthScope(host, p),
- new UsernamePasswordCredentials(user, pass));
+
+ 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()) {
+ 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$
+ if (user != null && !user.isEmpty() && pass != null) {
+ client.getState().setProxyCredentials(new AuthScope(host, p),
+ new UsernamePasswordCredentials(user, pass));
+ }
}
}
-
+
return client;
}
+ /**
+ * Get a HTTP Client instance
+ * @return the HttpClient
+ */
+ public static HttpClient getHttpClient() {
+ return getHttpClient(true);
+ }
+
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
index eb1b57d6..3d18bfc8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
@@ -68,7 +68,7 @@ public class LocalBKUConnector implements BkuSlConnector {
@Override
public SLResponse handleSLRequest(SLRequest request) throws SignatureException {
try {
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = BKUHelper.getHttpClient(false);
PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL);
String sl_request = request.getRequest();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
index eaccae5d..5507c739 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
@@ -104,7 +104,7 @@ public class LocalBKUState extends State {
public void run() {
try {
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = BKUHelper.getHttpClient(false);
PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL);