summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:37:10 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:37:10 +0000
commitd4fd1f68e792c42dde3f41ab94037691605ef910 (patch)
treeb6e994613df73c7feace0476d26ca3a622bc9699 /pdf-over-gui/src/main/java/at
parent305054be1f20c5cf083f8c551f01b5567c623d11 (diff)
downloadpdf-over-d4fd1f68e792c42dde3f41ab94037691605ef910.tar.gz
pdf-over-d4fd1f68e792c42dde3f41ab94037691605ef910.tar.bz2
pdf-over-d4fd1f68e792c42dde3f41ab94037691605ef910.zip
Changed SL transport to file upload for local bku, because ATrust cannot process base64
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@418 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java25
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java37
2 files changed, 22 insertions, 40 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 908ed244..68dd60bb 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
@@ -20,14 +20,19 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.eclipse.swt.SWT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
-import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
+import at.asit.pdfover.gui.controls.ErrorDialog;
+import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
@@ -79,16 +84,28 @@ public class LocalBKUState extends State {
SLRequest request = this.state.signingState
.getSignatureRequest();
- String sl_request = request.getBase64Request();
+ //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$
- log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
+ 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()));
+
+ Part[] parts = { xmlpart, filepart };
+
+ method.setRequestEntity(new MultipartRequestEntity(parts, method
+ .getParams()));
+
+ //log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
- method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
+ //method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
int returnCode = client.executeMethod(method);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
index 29f702e9..d82585db 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
@@ -17,7 +17,6 @@ package at.asit.pdfover.gui.workflow.states.mobilebku;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
@@ -28,15 +27,14 @@ import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
-import org.apache.commons.httpclient.methods.multipart.PartSource;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.httpclient.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.gui.workflow.states.LocalBKUState;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
-import at.asit.pdfover.signator.DocumentSource;
import at.asit.pdfover.signator.SLRequest;
import at.asit.pdfover.signator.SigningState;
@@ -53,39 +51,6 @@ public abstract class MobileBKUHandler {
private MobileBKUState state;
/**
- * A FileUploadSource
- */
- private final class FileUploadSource implements PartSource {
-
- private DocumentSource source;
-
- /**
- * Constructor
- *
- * @param source
- * the source
- */
- public FileUploadSource(DocumentSource source) {
- this.source = source;
- }
-
- @Override
- public long getLength() {
- return this.source.getLength();
- }
-
- @Override
- public String getFileName() {
- return "sign.pdf"; //$NON-NLS-1$
- }
-
- @Override
- public InputStream createInputStream() throws IOException {
- return this.source.getInputStream();
- }
- }
-
- /**
* Constructor
* @param state the MobileBKUState
*/