diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:41:33 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:41:33 +0000 |
commit | bc912e9c3c790f5c5c92c7732d0662dbecd251e2 (patch) | |
tree | 0e58fe555a45abdedd39ae8054ac870adc544ae8 /pdf-over-gui/src/main/java/at | |
parent | 7c4b5b31f1e0c7366ecc4c869b64d535817c0630 (diff) | |
download | pdf-over-bc912e9c3c790f5c5c92c7732d0662dbecd251e2.tar.gz pdf-over-bc912e9c3c790f5c5c92c7732d0662dbecd251e2.tar.bz2 pdf-over-bc912e9c3c790f5c5c92c7732d0662dbecd251e2.zip |
Make upload request type configurable
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@451 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.java | 35 |
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); |