aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-10-19 10:09:43 +0000
committerrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-10-19 10:09:43 +0000
commit4221d73ef087a94c9aebec6d49a918a435430078 (patch)
tree979899b9f7297c214dc5f6de02dfde9587cc6719 /pdf-as-web/src/main/java/at/gv/egiz
parent34428d03fc28b667a108c43e04c51c538a62c0d4 (diff)
downloadpdf-as-3-4221d73ef087a94c9aebec6d49a918a435430078.tar.gz
pdf-as-3-4221d73ef087a94c9aebec6d49a918a435430078.tar.bz2
pdf-as-3-4221d73ef087a94c9aebec6d49a918a435430078.zip
Added parameter signature block position (x and w) when connecting from outside
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@869 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java74
1 files changed, 60 insertions, 14 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
index 03db607..2856a7d 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
@@ -173,25 +173,65 @@ public class SignServlet extends HttpServlet
String session_id = (String) request.getParameter(FormFields.FIELD_SESSION_ID);
String sig_pos_y = (String) request.getParameter(FormFields.FIELD_SIGPOS_Y);
String sig_pos_p = (String) request.getParameter(FormFields.FIELD_SIGPOS_P);
-
+ String sig_pos_x = (String) request.getParameter(FormFields.FIELD_SIGPOS_X);
+ String sig_pos_w = (String) request.getParameter(FormFields.FIELD_SIGPOS_W);
+ String note = (String) request.getParameter(FormFields.FIELD_NOTE_ENABLED);
+
+ //Added by rpiazzi
+ log.debug("Received external request from "+request.getRemoteAddr());
+ log.debug("Parameter preview: "+preview);
+ log.debug("Parameter sig_type: "+sig_type);
+ log.debug("Parameter sig_app: "+sig_app);
+ log.debug("Parameter sig_mode: "+sig_mode);
+ log.debug("Parameter filename: "+filename);
+ log.debug("Parameter pdf_url: "+pdf_url);
+ log.debug("Parameter pdf_id: "+pdf_id);
+ log.debug("Parameter invoke_url: "+invoke_url);
+ log.debug("Parameter invoke_error_url: "+invoke_error_url);
+ log.debug("Parameter session_id: "+session_id);
+ log.debug("Parameter sig_pos_y: "+sig_pos_y);
+ log.debug("Parameter sig_pos_p: "+sig_pos_p);
+ log.debug("Parameter sig_pos_x: "+sig_pos_x);
+ log.debug("Parameter sig_pos_w: "+sig_pos_w);
+ log.debug("Parameter note: "+note);
+ //end added
+
// added by tknall
- if (sig_pos_y != null && sig_pos_p != null) {
- try
- {
- sigpos = new SignaturePositioning("y:" + sig_pos_y + ";p:" + sig_pos_p);
- }
- catch (PDFDocumentException e)
- {
- log.warn("Unable to create signature position object: " + e.getMessage(), e);
- }
+ if (sig_pos_y != null && sig_pos_p != null && sig_pos_x != null) {
+ if (sig_pos_w != null) {
+ try
+ {
+ sigpos = new SignaturePositioning("x:" + sig_pos_x + ";y:" + sig_pos_y + ";w:"+ sig_pos_w + ";p:" + sig_pos_p);
+ }
+ catch (PDFDocumentException e)
+ {
+ log.warn("Unable to create signature position object: " + e.getMessage(), e);
+ }
+ }
+ else {
+ try
+ {
+ sigpos = new SignaturePositioning("x:" + sig_pos_x + ";y:" + sig_pos_y + ";p:" + sig_pos_p);
+ }
+ catch (PDFDocumentException e)
+ {
+ log.warn("Unable to create signature position object: " + e.getMessage(), e);
+ }
+ }
} else {
log.debug("No signature position provided.");
}
+ if (note.equals("true")) {
+ sig_type = sig_type + "_NOTE";
+ }
+
// fixed by tknall: if we already have parameters "&" must be used instead of "?"
String paramSeparator = (pdf_url.indexOf("?") != -1) ? "&" : "?";
- String query = pdf_url + paramSeparator + FormFields.FIELD_PDF_ID + "=" + pdf_id;
- query = pdf_url;
+ String query = pdf_url + "/" + filename + paramSeparator + FormFields.FIELD_PDF_ID + "=" + pdf_id;
+ //query = pdf_url;
+
+ log.debug("Query string for loading pdf: "+query);
// wprinz: rem: this allocation is useless
// byte[] extern_pdf = new byte[Integer.parseInt(pdf_length)];
@@ -211,6 +251,12 @@ public class SignServlet extends HttpServlet
ud_extern.sig_mode = sig_mode;
ud_extern.sig_type = sig_type;
+ if (note.equals("true")) {
+ ud_extern.note=true;
+ }
+ else {
+ ud_extern.note=false;
+ }
ud_extern.note = true;
ud_extern.pdfa = false;
@@ -286,7 +332,7 @@ public class SignServlet extends HttpServlet
}
try
{
-
+ HttpSession session = request.getSession();
// not needed, that is done in sign()
// ud.pdfDataSource = PdfAS.applyStrictMode(ud.pdfDataSource);
@@ -315,7 +361,7 @@ public class SignServlet extends HttpServlet
// end add
//added by rpiazzi to change signature block with/without note
- if (si.note) {
+ if ((si.note) && (!si.type.contains("NOTE"))) {
if (si.type.equals(FormFields.VALUE_SIGNATURE_TYPE_DE)) {
si.type = "SIGNATURBLOCK_DE_NOTE";
session.setAttribute(SUBMITFORM_SIGNATURE_TYPE_KEY, si.type);