aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2006-12-07 20:13:50 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2006-12-07 20:13:50 +0000
commit548c8770e5ec6cb9bf73b7c341673d4077099a75 (patch)
treed7974be70545dc909a48dcb1ee5b7e2e8dac3082 /src
parentcee0fc1da69c84e0f7fc5382ebea77f2e50f5e44 (diff)
downloadpdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.tar.gz
pdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.tar.bz2
pdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.zip
knowcenter adjustments from 2006-12-01 merged
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@13 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java7
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/FoundBlock.java64
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/AbsoluteTextSignature.java102
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java71
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java75
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java44
9 files changed, 247 insertions, 126 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index 53fafe2..a80c410 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -387,8 +387,11 @@ public abstract class PdfAS
String caption = (String) captions.get(key_idx);
- int found_index = text.lastIndexOf(caption);
-
+ //int found_index = text.lastIndexOf(caption);
+// we're searching for captions that start at the beginning of the line.
+ int found_index = text.lastIndexOf("\n" + caption) + 1; // the +1 compensates the \n
+
+
if (key.equals(SignatureTypes.SIG_ID))
{
if (found_index < 0 || found_index >= last_index)
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/FoundBlock.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/FoundBlock.java
index 53afa10..1173666 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/FoundBlock.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/FoundBlock.java
@@ -96,7 +96,7 @@ public class FoundBlock
/**
* Tells, if this block is semantically equal to the other block.
*
- * Two blocks are semantically equal, if all the required have the
+ * Two blocks are semantically equal, if all the required fields (except SIG_ID) have the
* same captions in the same order.
*
* @param other_block
@@ -106,25 +106,27 @@ public class FoundBlock
*/
public boolean isSemanticallyEqual(FoundBlock other_block)
{
- List this_keys = filterOutNonRequiredFoundKeys(this.found_keys);
- List other_keys = filterOutNonRequiredFoundKeys(other_block.found_keys);
+ return this.std.isSemanticallyEqual(other_block.std);
- if (this_keys.size() != other_keys.size())
- {
- return false;
- }
-
- for (int i = 0; i < this_keys.size(); i++)
- {
- FoundKey this_found_key = (FoundKey) this_keys.get(i);
- FoundKey other_found_key = (FoundKey) other_keys.get(i);
-
- if (!this_found_key.isSemanticallyEqual(other_found_key))
- {
- return false;
- }
- }
- return true;
+// List this_keys = filterOutNonRequiredFoundKeys(filterOutSIG_ID(this.found_keys));
+// List other_keys = filterOutNonRequiredFoundKeys(filterOutSIG_ID(other_block.found_keys));
+//
+// if (this_keys.size() != other_keys.size())
+// {
+// return false;
+// }
+//
+// for (int i = 0; i < this_keys.size(); i++)
+// {
+// FoundKey this_found_key = (FoundKey) this_keys.get(i);
+// FoundKey other_found_key = (FoundKey) other_keys.get(i);
+//
+// if (!this_found_key.isSemanticallyEqual(other_found_key))
+// {
+// return false;
+// }
+// }
+// return true;
}
/**
@@ -132,7 +134,7 @@ public class FoundBlock
*
* @param found_keys The List of found keys.
*
- * @return Rturns the subset List which contains only the required keys.
+ * @return Returns the subset List which contains only the required keys.
*/
protected static List filterOutNonRequiredFoundKeys (List found_keys)
{
@@ -150,6 +152,28 @@ public class FoundBlock
}
return required_found_keys;
}
+
+ /**
+ * Filters out a SIG_ID found key.
+ * @param found_keys The List of found keys.
+ * @return Returns the subset List which contains all keys but the SIG_ID.
+ */
+ protected static List filterOutSIG_ID (List found_keys)
+ {
+ List nonsigid_found_keys = new ArrayList(found_keys.size());
+ for (int i = 0; i < found_keys.size(); i++)
+ {
+ FoundKey this_found_key = (FoundKey) found_keys.get(i);
+
+ if (this_found_key.key.equals(SignatureTypes.SIG_ID))
+ {
+ continue;
+ }
+
+ nonsigid_found_keys.add(this_found_key);
+ }
+ return nonsigid_found_keys;
+ }
/**
* Tells, if this block is strictly semantically equal to the other block.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
index bbcebef..fccdfd0 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
@@ -13,7 +13,7 @@
* LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
- * $Id: TextualVerificator_1_0_0.java,v 1.4 2006/10/31 08:08:00 wprinz Exp $
+ * $Id: TextualVerificator_1_0_0.java,v 1.5 2006/11/28 07:45:09 wprinz Exp $
*/
package at.knowcenter.wag.egov.egiz.framework.verificators;
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AbsoluteTextSignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AbsoluteTextSignature.java
index 5523041..658f7dd 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AbsoluteTextSignature.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AbsoluteTextSignature.java
@@ -14,7 +14,8 @@
* DERIVATIVES.
*
* $Id: AbsoluteTextSignature.java,v 1.1 2006/10/31 08:08:33 wprinz Exp $
- */package at.knowcenter.wag.egov.egiz.pdf;
+ */
+package at.knowcenter.wag.egov.egiz.pdf;
import java.util.ArrayList;
import java.util.Collections;
@@ -36,6 +37,7 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
/**
* Contains methods and helpers that implement the absolute text signature.
+ *
* @author wprinz
*/
public class AbsoluteTextSignature
@@ -46,7 +48,6 @@ public class AbsoluteTextSignature
*/
private static final Logger logger = ConfigLogger.getLogger(AbsoluteTextSignature.class);
-
/**
* Extracts all signature holders from a given text.
*
@@ -138,14 +139,14 @@ public class AbsoluteTextSignature
*/
public static FoundBlock findLatestBlock(String text) throws SignatureException, SignatureTypesException
{
-// try
-// {
-// writeTextToFile(text, new File("C:\\wprinz\\text.utf8.txt"));
-// }
-// catch (IOException e)
-// {
-// e.printStackTrace();
-// }
+ // try
+ // {
+ // writeTextToFile(text, new File("C:\\wprinz\\text.utf8.txt"));
+ // }
+ // catch (IOException e)
+ // {
+ // e.printStackTrace();
+ // }
SignatureTypes sig_types = SignatureTypes.getInstance();
List signatureTypes_ = sig_types.getSignatureTypeDefinitions();
@@ -212,7 +213,7 @@ public class AbsoluteTextSignature
throw new SignatureException(314, "The latest blocks weren't semantically equal.");
}
- FoundBlock latest_block = (FoundBlock) latest_blocks.get(0);
+ FoundBlock latest_block = chooseMostPossibleSemanticallyEqualBlock(latest_blocks);
logger.debug("latest block = " + latest_block);
return latest_block;
}
@@ -245,7 +246,20 @@ public class AbsoluteTextSignature
String last_caption = (String) captions.get(0);
logger.debug("last_caption = " + last_caption);
- List found_last_captions = findIndices(text, last_caption);
+ List found_last_captions = findIndicesWithStartingNL(text, last_caption);
+ if (last_key.equals(SignatureTypes.SIG_ID))
+ {
+ logger.debug("Last key is SIG_ID, so it may not be present. Searching for the previous to last key.");
+ String prevlast_key = (String) keys.get(1);
+ logger.debug("last_key = " + prevlast_key);
+ String prevlast_caption = (String) captions.get(1);
+ logger.debug("prevlast_caption = " + last_caption);
+ List found_prevlast_captions = findIndicesWithStartingNL(text, prevlast_caption);
+ if (!found_prevlast_captions.isEmpty())
+ {
+ found_last_captions.addAll(found_prevlast_captions);
+ }
+ }
if (logger.isDebugEnabled())
{
logger.debug("found " + found_last_captions.size() + " last captions.");
@@ -255,6 +269,7 @@ public class AbsoluteTextSignature
}
}
+
for (int lci = 0; lci < found_last_captions.size(); lci++)
{
int last_caption_index = ((Integer) found_last_captions.get(lci)).intValue();
@@ -300,7 +315,8 @@ public class AbsoluteTextSignature
}
/**
- * Finds all indices of the given subtext within a given text.
+ * Finds all indices of the given subtext (starting at a new line) within a
+ * given text.
*
* <p>
* This is usually used to find the indices of the last captions.
@@ -312,17 +328,30 @@ public class AbsoluteTextSignature
* The subtext to be sought.
* @return Returns the List of found indices.
*/
- public static List findIndices(String text, String subtext)
+ public static List findIndicesWithStartingNL(String text, String subtext)
{
List found_indices = new ArrayList();
+
+ // // for some reason "^" + subtext doesn't work as a pattern
+ // String pattern = "\n" + subtext;
+ // Pattern p = Pattern.compile(pattern);
+ // Matcher m = p.matcher(text);
+ //
+ // while (m.find())
+ // {
+ // int found_index = m.start() + 1; // +1 removes the newline
+ // found_indices.add(new Integer(found_index));
+ // }
+
int search_from_index = 0;
for (;;)
{
- int found_index = text.indexOf(subtext, search_from_index);
+ int found_index = text.indexOf("\n" + subtext, search_from_index);
if (found_index < 0)
{
break;
}
+ found_index += 1; // The +1 compensates the "\n"
found_indices.add(new Integer(found_index));
search_from_index = found_index + subtext.length();
}
@@ -471,7 +500,7 @@ public class AbsoluteTextSignature
int this_end_index = findEndOfValue(text, this_key.start_index);
if (this_end_index != next_key.start_index)
{
- logger.warn("multi line value: " + this_key);
+ logger.debug("multi line value: " + this_key);
// throw new RuntimeException("The end index of found key " + this_key +
// " doesn't match the start index of found key " + next_key);
}
@@ -653,4 +682,45 @@ public class AbsoluteTextSignature
return latest_blocks;
}
+ /**
+ * Chooses the most possible (best choice) block of the list of semantically
+ * equal blocks.
+ *
+ * <p>
+ * Thus blocks are considered semantically equal if their required keys are
+ * semantically equal, semantically equal blocks may still differ in the
+ * number of their non required fields. This may lead to multiple found blocks
+ * of the same size in characters, but where some blocks' elements swallow
+ * elements found by other blocks.
+ * </p>
+ * <p>
+ * The strategy to avoid this is to choose the very one block with the maximum
+ * number of captions. This block has extracted most information from the
+ * text.
+ * </p>
+ *
+ * @param found_blocks
+ * The List of semantically equal blocks.
+ * @return Returns the best choice FoundBlock.
+ */
+ public static FoundBlock chooseMostPossibleSemanticallyEqualBlock(
+ List found_blocks)
+ {
+ int largest_block_index = 0;
+ FoundBlock largest_block = (FoundBlock) found_blocks.get(0);
+
+ for (int i = 1; i < found_blocks.size(); i++)
+ {
+ FoundBlock current_block = (FoundBlock) found_blocks.get(i);
+
+ if (current_block.found_keys.size() > largest_block.found_keys.size())
+ {
+ largest_block = current_block;
+ largest_block_index = i;
+ }
+ }
+
+ logger.debug("Chose largest block with index #" + largest_block_index + ": " + largest_block);
+ return largest_block;
+ }
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
index bed1b65..c98aee8 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
@@ -324,7 +324,7 @@ public class PDFPage extends PDFTextStripper
protected void processOperator(PDFOperator operator, List arguments) throws IOException
{
- logger_.debug("operator = " + operator);
+ //logger_.debug("operator = " + operator);
super.processOperator(operator, arguments);
}
@@ -387,7 +387,7 @@ public class PDFPage extends PDFTextStripper
public void process(PDFOperator operator, List arguments) throws IOException
{
COSName name = (COSName) arguments.get(0);
- logger_.debug("<Do name=\"" + name.getName() + "\">");
+ //logger_.debug("<Do name=\"" + name.getName() + "\">");
// PDResources res = context.getResources();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
index b26abd8..f2e409f 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
@@ -13,18 +13,16 @@
* LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
- * $Id: SignatureObject.java,v 1.5 2006/08/25 17:09:41 wprinz Exp $
+ * $Id: SignatureObject.java,v 1.7 2006/10/31 08:18:56 wprinz Exp $
*/
package at.knowcenter.wag.egov.egiz.sig;
-import java.awt.Color;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -37,7 +35,6 @@ import org.apache.log4j.Logger;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-import at.knowcenter.wag.egov.egiz.exceptions.ErrorCodeException;
import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException;
import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
@@ -248,7 +245,8 @@ public class SignatureObject implements Serializable
defaultImageStyle_.setPadding(3);
defaultImageStyle_.setHAlign(Style.CENTER);
defaultImageStyle_.setVAlign(Style.MIDDLE);
- defaultImageStyle_.setBgColor(new Color(255, 255, 255));
+// defaultImageStyle_.setBgColor(new Color(255, 255, 255));
+ defaultImageStyle_.setBgColor(null);
defaultCaptionStyle_.setHAlign(Style.CENTER);
defaultCaptionStyle_.setVAlign(Style.MIDDLE);
@@ -1407,10 +1405,10 @@ public class SignatureObject implements Serializable
}
}
// value = new String(CodingHelper.encodeUTF8(value));
- if (logger_.isDebugEnabled())
- {
- logger_.debug("key:" + key + " value:" + value);
- }
+// if (logger_.isDebugEnabled())
+// {
+// logger_.debug("key:" + key + " value:" + value);
+// }
setSigValue(key, value);
}
}
@@ -1532,57 +1530,6 @@ public class SignatureObject implements Serializable
return strg;
}
- // /**
- // * Used only for testing!
- // *
- // * @param args
- // */
- // public static void main(String[] args)
- // {
- //
- // String sig_strg1 = " Verfahren
- // urn:publicid:egov.graz.gv.at:AS+bescheid+tb-1.0 Datum 2006-01-18T14:57:33
- // Inhaber A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH ,
- // a-sign-corporate-light-02 Aussteller
- // CN=a-sign-corporate-light-02,OU=a-sign-corporate-light-02,O=A-Trust Ges. f.
- // Sicherheitssysteme im elektr. Datenverkehr GmbH,C=AT Seriennummer 86710
- // Signaturwert
- // p/EdZadVe0LPoWtvkMQmsCtH7nwH5Bm9hV0+lfSdT8k4oeKlNtqwNIYFm1mpGd3B
- // bgggEtSvth/sbsm0BYMse33j3lYxYvT+kdui8QNa+iHCm23S2YdvzrTtay6/DSgZ
- // 48c7vmMR7wOKNZsVx2SrZgoD4XK+xag9CCsbjGeEyyM= Hinweis: Dieses Dokument ist
- // nur in elektronischer Form gültig!";
- // String sig_strg2 = " Signiert von BMI SU-ZMR Datum 2006-02-08T15:03:07
- // Zertifikat A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH,
- // a-sign-corporate-light-02, AT (80524) Verfahren
- // urn:publicid:bmi.gv.at:ZP+bescheid+mb-1.2 Seriennummer 1234 56789
- // Signaturwert
- // c27g+sQ57rMYg6MaOjQ206VSQzkSszR/715RO/ZR3UYptP+YST7l9BEX1vUBi+3W
- // h4oDEJtHJ+ubWfiu7yG8xWzmtCFwJLe1Ubg94v8SWCUgd2xg/PsN52+K6wolZF/i
- // 0M1RTzFA2QisL3xKSVSw8h0pGp0r3/kigcQaCJ7AH1M= Weitere Hinweise zu dieser
- // elektronischen Meldebestätigung finden Sie unter
- // https://meldung.cio.gv.at/egovMB/info/mb_info.html,Informationen zur
- // Signatur unter https://meldung.cio.gv.at/egovMB/info/mb_sig.html";
- // String sig_strg3 = "Signaturwert
- // c27g+sQ57rMYg6MaOjQ206VSQzkSszR/715RO/ZR3UYptP+YST7l9BEX1vUBi+3W
- // h4oDEJtHJ+ubWfiu7yG8xWzmtCFwJLe1Ubg94v8SWCUgd2xg/PsN52+K6wolZF/i
- // 0M1RTzFA2QisL3xKSVSw8h0pGp0r3/kigcQaCJ7AH1M= Datum 2006-02-08T15:03:07
- // Unterzeichner Franz Morak Aussteller
- // CN=a-sign-corporate-light-02,OU=a-sign-corporate-light-02,O=A-Trust Ges. f.
- // Sicherheitssysteme im elektr. Datenverkehr GmbH,C=AT Seriennummer 43312
- // Weitere Hinweise weiruqweruqweruqerqi4123491348123ß4";
- // try
- // {
- // SignatureSeparator sig_sep = new SignatureSeparator();
- // sig_sep.separateBlock(sig_strg3);
- // SignatureObject sig_obj = sig_sep.getFirstSignatureObject();
- // System.out.println(sig_obj.toString());
- //
- // Table table = sig_obj.getAbstractTable();
- // System.out.println(table.toString());
- // }
- // catch (SignatureTypesException e)
- // {
- // e.printStackTrace();
- // }
- // }
+
+
} \ No newline at end of file
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java
index 4b14019..c8d8818 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java
@@ -407,17 +407,88 @@ public class SignatureTypeDefinition implements Serializable
{
String key = (String) this.sortedKeys_.get(i);
SignatureFieldDefinition sfd = readFieldDefinition(key);
- //sfd.brev = SignatureTypes.ALL_SIG_BREV[i];
+ // sfd.brev = SignatureTypes.ALL_SIG_BREV[i];
this.field_definitions_.add(sfd);
}
}
-
+
/**
* Returns the list of field definitions of this Signature profile.
+ *
* @return Returns the list of field definitions of this Signature profile.
*/
public List getFieldDefinitions()
{
return this.field_definitions_;
}
+
+ /**
+ * Tells if this signature profile is semantically equal to the other
+ * signature profile.
+ *
+ * <p>
+ * One profile is semantically equal to another one if the captions and keys
+ * of both profiles are equal and have the same order.
+ * </p>
+ *
+ * @param other
+ * The other signature profile.
+ * @return Returns true, if this profile is semantically equivalent to the
+ * other profile.
+ */
+ public boolean isSemanticallyEqual(SignatureTypeDefinition other)
+ {
+ List this_keys = filterOutNonRequiredFoundKeys(this.sortedKeys_);
+ List other_keys = filterOutNonRequiredFoundKeys(other.sortedKeys_);
+
+ if (this_keys.size() != other_keys.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < this_keys.size(); i++)
+ {
+ String this_key = (String) this_keys.get(i);
+ String other_key = (String) other_keys.get(i);
+
+ if (!this_key.equals(other_key))
+ {
+ return false;
+ }
+
+ String this_caption = this.getCaptionFromKey(this_key);
+ String other_caption = other.getCaptionFromKey(other_key);
+
+ if (!this_caption.equals(other_caption))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Filters out all non required keys from the List of keys.
+ *
+ * @param keys The List of keys.
+ *
+ * @return Returns the subset List which contains only the required keys.
+ */
+ protected static List filterOutNonRequiredFoundKeys (List keys)
+ {
+ List required_keys = new ArrayList(keys.size());
+ for (int i = 0; i < keys.size(); i++)
+ {
+ String this_key = (String) keys.get(i);
+
+ if (!SignatureTypes.isRequiredKey(this_key))
+ {
+ continue;
+ }
+
+ required_keys.add(this_key);
+ }
+ return required_keys;
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
index de1ee57..5e323a2 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
@@ -187,7 +187,7 @@ public class MOAConnector implements Connector
sign_req_str = sign_req_str.replaceFirst("KeyIdentifierReplace", key_ident);
if (logger_.isDebugEnabled())
{
- logger_.debug("error_signature_response = " + sign_req_str);
+ //logger_.debug("error_signature_response = " + sign_req_str);
// FileHelper.writeToFile(sign_request_filename + "_signText.xml",
// signText);
}
@@ -261,7 +261,7 @@ public class MOAConnector implements Connector
{
if (logger_.isDebugEnabled())
{
- logger_.debug("error_signature_response = " + response_string);
+ //logger_.debug("response_string = " + response_string);
// FileHelper.writeToFile(sign_request_filename + "_response.xml",
// response_string);
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java
index fb5d2e3..b79dd87 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/AsynchronousRedirectResponder.java
@@ -128,19 +128,18 @@ public class AsynchronousRedirectResponder extends HttpServlet
dispatchToRedirectRefreshPage(request, response, refresh_url);
return;
}
-
- si.finished = false;
-
+
+ // si.finished is true, but maybe there are more requests to process.
if (si.current_operation < si.requests.length)
{
+ si.finished = false;
+
LocalRequestHelper.prepareDispatchToLocalConnectionPage(si.requests[si.current_operation], request, response);
dispatch(request, response, LocalRequestHelper.LOCAL_CONNECTION_PAGE_JSP);
return;
}
// all requests have been carried out.
- //session.removeAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
- //SessionTable.remove(si.session_id);
BKUConnector local_conn = (BKUConnector) ConnectorFactory.createConnector(si.connector);
@@ -161,22 +160,29 @@ public class AsynchronousRedirectResponder extends HttpServlet
//logger_.debug("AsyncRedirResponder: si.response_string[0] = " + si.response_string[0]);
logger_.debug("AsyncRedirResponder: si.current_op = " + si.current_operation);
- if (si.response_string[0] == null)
+ // The response string must not be null here - otherwise finished mustn't have been set!
+// if (si.response_string[0] == null)
+// {
+// String url = request.getRequestURL().toString();
+// logger_.debug("RequestURL = " + url);
+// String refresh_url = response.encodeURL(url);
+// logger_.debug("RefreshURL = " + refresh_url);
+// dispatchToRedirectRefreshPage(request, response, refresh_url);
+// return ;
+// }
+
+ // A download blocker may have blocked the first download.
+ // So, if the user asks for the document a second time and the sign_result
+ // has already been computed - don't recompute it.
+ if (si.sign_result == null)
{
- String url = request.getRequestURL().toString();
- logger_.debug("RequestURL = " + url);
- String refresh_url = response.encodeURL(url);
- logger_.debug("RefreshURL = " + refresh_url);
- dispatchToRedirectRefreshPage(request, response, refresh_url);
- return ;
+ si.iui.signed_signature_object = local_conn.analyzeSignResponse(si.response_string[0], si.type);
+
+ PdfASID algorithm = FormFields.translateSignatureModeToPdfASID(si.mode);
+ Signator signator = SignatorFactory.createSignator(algorithm);
+
+ si.sign_result = signator.finishSign(si.iui);
}
-
- si.iui.signed_signature_object = local_conn.analyzeSignResponse(si.response_string[0], si.type);
-
- PdfASID algorithm = FormFields.translateSignatureModeToPdfASID(si.mode);
- Signator signator = SignatorFactory.createSignator(algorithm);
-
- si.sign_result = signator.finishSign(si.iui);
Sign.returnSignResponse(si, response);
}