summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2016-06-30 14:39:20 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2016-06-30 14:39:20 +0200
commitaa8e0f5082cab99a8969da5c07d12d4a5dd06792 (patch)
tree364fd1dcf8dc91348ddc04d8bcc84e60caac54f5 /pdf-over-gui/src/main/java/at/asit
parentd6aa86ff603d7acaba3137cec1484d54bae3731b (diff)
downloadpdf-over-aa8e0f5082cab99a8969da5c07d12d4a5dd06792.tar.gz
pdf-over-aa8e0f5082cab99a8969da5c07d12d4a5dd06792.tar.bz2
pdf-over-aa8e0f5082cab99a8969da5c07d12d4a5dd06792.zip
Split HttpClient generation for Mobile BKU
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java3
-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/bku/mobile/ATrustHandler.java13
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java2
7 files changed, 25 insertions, 17 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 765a6706..74a5516b 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
@@ -68,7 +68,6 @@ public class BKUHelper {
* @return the HttpClient
*/
public static HttpClient getHttpClient() {
- return getHttpClient(true);
+ return getHttpClient(false);
}
-
}
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 3d18bfc8..eb1b57d6 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(false);
+ HttpClient client = BKUHelper.getHttpClient();
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/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
index a493d109..99237204 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
@@ -33,7 +33,6 @@ import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.bku.BKUHelper;
import at.asit.pdfover.gui.controls.Dialog;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.Dialog.ICON;
@@ -116,7 +115,7 @@ public class ATrustHandler extends MobileBKUHandler {
ATrustStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(status.getBaseURL() + "/identification.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$
post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$
@@ -180,7 +179,7 @@ public class ATrustHandler extends MobileBKUHandler {
// Post again to skip
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(status.getBaseURL() + "/ExpiresInfo.aspx?sid=" + t_sessionID); //$NON-NLS-1$
post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$
@@ -250,7 +249,7 @@ public class ATrustHandler extends MobileBKUHandler {
ATrustStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(status.getBaseURL()
+ "/signature.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$
@@ -318,7 +317,7 @@ public class ATrustHandler extends MobileBKUHandler {
ATrustStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(status.getBaseURL()
+ "/signature.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$
@@ -340,7 +339,7 @@ public class ATrustHandler extends MobileBKUHandler {
ATrustStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
GetMethod get = new GetMethod(status.getBaseURL() + "/" + //$NON-NLS-1$
status.getQRCode());
@@ -370,7 +369,7 @@ public class ATrustHandler extends MobileBKUHandler {
ATrustStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
GetMethod get = new GetMethod(status.getBaseURL()
+ "/signature.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
index b282811f..27f30cbe 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
@@ -30,7 +30,6 @@ import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.bku.BKUHelper;
import at.asit.pdfover.gui.controls.Dialog;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.Dialog.ICON;
@@ -98,7 +97,7 @@ public class IAIKHandler extends MobileBKUHandler {
IAIKStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(status);
PostMethod post = new PostMethod(status.getBaseURL());
post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$
@@ -144,7 +143,7 @@ public class IAIKHandler extends MobileBKUHandler {
return;
}
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(status);
String redirectURL = status.getBaseURL().substring(0,
status.getBaseURL().lastIndexOf('/',
@@ -235,7 +234,7 @@ public class IAIKHandler extends MobileBKUHandler {
IAIKStatus status = getStatus();
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(status);
PostMethod post = new PostMethod(status.getBaseURL());
post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
index 6c6b9f84..434a351a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
@@ -33,7 +33,6 @@ import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.bku.BKUHelper;
import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.gui.workflow.states.LocalBKUState;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
@@ -70,7 +69,7 @@ public abstract class MobileBKUHandler {
*/
public String postSLRequest(String mobileBKUUrl, SLRequest request) throws IOException {
MobileBKUHelper.registerTrustedSocketFactory();
- HttpClient client = BKUHelper.getHttpClient();
+ HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(mobileBKUUrl);
String sl_request;
@@ -274,6 +273,7 @@ public abstract class MobileBKUHandler {
*/
protected String executeGet(HttpClient client, GetMethod get) throws IOException {
log.debug("Getting " + get.getURI()); //$NON-NLS-1$
+
int returnCode = client.executeMethod(get);
String redirectLocation = null;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
index b9975167..38ca66e3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
@@ -23,6 +23,7 @@ import org.apache.commons.httpclient.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.bku.BKUHelper;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPasswordException;
import at.asit.pdfover.gui.exceptions.PasswordTooLongException;
@@ -251,4 +252,14 @@ public class MobileBKUHelper {
Protocol.registerProtocol("https", //$NON-NLS-1$
new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
}
+
+ /**
+ * Get a HTTP Client instance
+ * @param status the mobile BKU status
+ * @return the HttpClient
+ */
+ public static HttpClient getHttpClient(MobileBKUStatus status) {
+ HttpClient client = BKUHelper.getHttpClient(true);
+ return client;
+ }
}
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 5507c739..eaccae5d 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(false);
+ HttpClient client = BKUHelper.getHttpClient();
PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL);