summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java35
1 files changed, 21 insertions, 14 deletions
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 54c24abc..31cf1e06 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
@@ -65,6 +65,11 @@ public class LocalBKUState extends State {
public static final String PDF_OVER_USER_AGENT_STRING = "PDF-Over 4.0"; //$NON-NLS-1$
/**
+ * Whether to use Base64 or FileUpload Request
+ */
+ public static final boolean USE_BASE64_REQUEST = true;
+
+ /**
*
*/
private final class SignLocalBKUThread implements Runnable {
@@ -84,28 +89,30 @@ public class LocalBKUState extends State {
SLRequest request = this.state.signingState
.getSignatureRequest();
- String sl_request = request.getBase64Request();
- //String sl_request = request.getFileUploadRequest();
-
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(
"http://127.0.0.1:3495/http-security-layer-request"); //$NON-NLS-1$
- StringPart xmlpart = new StringPart(
- "XMLRequest", sl_request, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
+ String sl_request = null;
+ if (USE_BASE64_REQUEST)
+ {
+ sl_request = request.getBase64Request();
+ method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
+ } else {
+ sl_request = request.getFileUploadRequest();
+ StringPart xmlpart = new StringPart(
+ "XMLRequest", sl_request, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- /*FilePart filepart = new FilePart("fileupload", //$NON-NLS-1$
- new FileUploadSource(request.getSignatureData()));
+ FilePart filepart = new FilePart("fileupload", //$NON-NLS-1$
+ new FileUploadSource(request.getSignatureData()));
- Part[] parts = { xmlpart, filepart };
-
- method.setRequestEntity(new MultipartRequestEntity(parts, method
- .getParams()));*/
-
- //log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
+ Part[] parts = { xmlpart, filepart };
- method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
+ method.setRequestEntity(new MultipartRequestEntity(parts, method
+ .getParams()));
+ }
+ //log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
int returnCode = client.executeMethod(method);