diff options
author | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-10-07 12:06:47 +0000 |
---|---|---|
committer | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-10-07 12:06:47 +0000 |
commit | 7c5cc8940f91412ceccf456672d9d41860d877d2 (patch) | |
tree | b030fd8a4a901d845ed73cb5d5be2f21cd03aa1e /src/main/java | |
parent | 2bff3a44c617a330af57f5c590b52e83b37e1427 (diff) | |
download | pdf-as-3-7c5cc8940f91412ceccf456672d9d41860d877d2.tar.gz pdf-as-3-7c5cc8940f91412ceccf456672d9d41860d877d2.tar.bz2 pdf-as-3-7c5cc8940f91412ceccf456672d9d41860d877d2.zip |
Provide profile description via API call.
More logging.
WebApp: Bugfix for IE9 (download Link accessed twice)
WebApp: Prevent Set-Cookie to be sent to BKU
WebApp: Statistical logging added
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@592 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
8 files changed, 61 insertions, 25 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java index a490327..d018050 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java +++ b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java @@ -11,7 +11,8 @@ import java.util.Properties; * @author wprinz
*/
public interface SignatureProfile {
- // TODO: the full profile information will be implemented in future
+
+ // TODO: implement full profile support
/**
* Returns the profile id.
@@ -27,8 +28,6 @@ public interface SignatureProfile { */
public String getMOAKeyIdentifier();
- // start - modified by tknall
-
/**
* Returns the entries relevant to the search algorithm for signature blocks.<br/>
* e.g. properties starting with <code>sig_obj.PROFILE.key.</code> and
@@ -42,6 +41,11 @@ public interface SignatureProfile { */
public Properties getSignatureBlockEntries();
- // stop - modified by tknall
+ /**
+ * Returns the profile description.
+ *
+ * @return The profile description.
+ */
+ public String getProfileDescription();
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java index e94acfd..2923347 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java @@ -172,9 +172,10 @@ public class PdfAsObject implements PdfAs final String profileId = profile.getType();
log.debug("Processing profile \"" + profileId + "\".");
final String moaKeyIdentifier = settings.getSetting("sig_obj." + profileId + "." + MOA_SIGN_KEY_IDENTIFIER_KEY, defaultMoaKeyIdentifiert);
+ final String profileDescription = settings.getSetting("sig_obj." + profileId + "." + SignatureTypes.SIG_DESCR, null);
// modified by tknall
- SignatureProfileImpl signatureProfile = new SignatureProfileImpl(profileId, moaKeyIdentifier);
+ SignatureProfileImpl signatureProfile = new SignatureProfileImpl(profileId, profileDescription, moaKeyIdentifier);
// start - added by tknall
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java index fb78564..90e2ca0 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java @@ -5,6 +5,8 @@ package at.gv.egiz.pdfas.impl.api.commons; import java.util.Properties;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
import at.gv.egiz.pdfas.api.commons.SignatureProfile;
/**
@@ -24,15 +26,16 @@ public class SignatureProfileImpl implements SignatureProfile { */
protected String moaKeyIdentifier = null;
- // start - added by tknall
-
/**
* Properties containing the layout settings relevant to the search algorithm
* for signature blocks.
*/
protected Properties signatureBlockEntries;
-
- // stop - added by tknall
+
+ /**
+ * Short description of the profile.
+ */
+ protected String profileDescription;
/**
* Constructor.
@@ -40,13 +43,30 @@ public class SignatureProfileImpl implements SignatureProfile { * @param profileId
* The profile identifier.
* @param moaKeyIdentifier
- * The MOA key identifiert of this profile.
+ * The MOA key identifier of this profile.
*/
public SignatureProfileImpl(String profileId, String moaKeyIdentifier) {
this.profileId = profileId;
this.moaKeyIdentifier = moaKeyIdentifier;
this.signatureBlockEntries = new Properties();
}
+
+ /**
+ * Constructor.
+ *
+ * @param profileId
+ * The profile identifier.
+ * @param profileDescription
+ * The profile description.
+ * @param moaKeyIdentifier
+ * The MOA key identifier of this profile.
+ */
+ public SignatureProfileImpl(String profileId, String profileDescription, String moaKeyIdentifier) {
+ this.profileId = profileId;
+ this.moaKeyIdentifier = moaKeyIdentifier;
+ this.profileDescription = profileDescription;
+ this.signatureBlockEntries = new Properties();
+ }
/**
* @see at.gv.egiz.pdfas.api.commons.SignatureProfile#getProfileId()
@@ -62,8 +82,6 @@ public class SignatureProfileImpl implements SignatureProfile { return this.moaKeyIdentifier;
}
- // start - added by tknall
-
/**
* @see at.gv.egiz.pdfas.api.commons.SignatureProfile#getSignatureBlockEntries()
*/
@@ -86,7 +104,21 @@ public class SignatureProfileImpl implements SignatureProfile { public void setSignatureBlockEntries(Properties signatureBlockEntries) {
this.signatureBlockEntries = signatureBlockEntries;
}
+
+ /**
+ * Returns the profile description.
+ * @return The profile description.
+ */
+ public String getProfileDescription() {
+ return this.profileDescription;
+ }
- // stop - added by tknall
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("profileId", this.profileId)
+ .append("profileDescription", this.profileDescription)
+ .append("moaKeyIdentifier", this.moaKeyIdentifier)
+ .toString();
+ }
}
diff --git a/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java b/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java index 1ed0cab..65015e1 100644 --- a/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java +++ b/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java @@ -117,7 +117,7 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria */
public void valueBound(HttpSessionBindingEvent event)
{
- log.debug("Bound SignSessionInformation to session.");
+ log.debug("Bound SignSessionInformation to session (ID=" + event.getSession().getId() + ").");
}
/**
@@ -125,7 +125,7 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria */
public void valueUnbound(HttpSessionBindingEvent event)
{
- log.debug("Unbound SignSessionInformation from session.");
+ log.debug("Unbound SignSessionInformation from session (ID=" + event.getSession().getId() + ").");
if (this.pdfDataSource != null)
{
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 59c6b93..431f7b2 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -100,7 +100,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation
* of the api or the web application.
*/
- public static final String PDFAS_VERSION = "3.1.1-snapshot (20100812)";
+ public static final String PDFAS_VERSION = "3.1.1-snapshot (20101007)";
/**
* The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java index 7cf762e..621ee6f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java @@ -296,8 +296,6 @@ public class DataURLServlet extends HttpServlet String downloadURL = response.encodeRedirectURL(LocalRequestHelper.getLocalContextAddress(request, response) + "/ProvidePDF");
log.debug("Creating download URL \"" + downloadURL + "\".");
session.setAttribute(SessionAttributes.DOWNLOAD_URL_FOR_SIGNED_PDF_DOCUMENT, downloadURL);
- Cookie cookie = new Cookie("JSESSIONID", session.getId());
- response.addCookie(cookie);
temporaryRedirect(response.encodeRedirectURL(LocalRequestHelper.getLocalContextAddress(request, response) + "/jsp/download.jsp") , response);
// Not needed due to temporaryRedirect.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java index 0efed03..715b5be 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java @@ -57,7 +57,9 @@ public class ProvidePDFServlet extends HttpServlet { return;
} else {
log.debug("Signed pdf found.");
- session.removeAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT);
+ // do NOT remove signed pdf document from session since IE9 loads this page/servlet twice...)
+ // Popup-Blocker, Link-Prefetching, IE 9 SmartScreen-Filter...???
+ // session.removeAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT);
log.debug("Returning signed pdf to browser.");
SignServletHelper.returnSignResponse(si, request, response);
log.debug("Removing free text (if any) from session.");
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java index 4c93b73..982e872 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java @@ -87,6 +87,7 @@ public class SignServlet extends HttpServlet * The log.
*/
private static Log log = LogFactory.getLog(SignServlet.class);
+ private static Log statLog = LogFactory.getLog("statistic");
protected void dispatch(HttpServletRequest request, HttpServletResponse response, String resource) throws ServletException, IOException
{
@@ -172,8 +173,7 @@ public class SignServlet extends HttpServlet // for performance measurement
long startTime = 0;
- long fileSize = 0;
- if (log.isInfoEnabled()) {
+ if (statLog.isInfoEnabled()) {
startTime = System.currentTimeMillis();
}
@@ -310,13 +310,12 @@ public class SignServlet extends HttpServlet SignServletHelper.finishSign(si, request, response, getServletContext());
// for performance measurement
- if (log.isInfoEnabled()) {
+ if (statLog.isInfoEnabled()) {
long endTime = System.currentTimeMillis();
// String toReport = "SIGN;" + si.mode + ";" + si.filename + ";"+ fileSize + ";" +
- String toReport = "SIGN;" + si.mode + ";XXX;"+ fileSize + ";" +
- (endTime - startTime);
+ String toReport = "SIGN;" + si.mode + ";" + si.connector + ";" + si.pdfDataSource.getLength() + ";" + (endTime - startTime);
- log.info(toReport);
+ statLog.info(toReport);
}
}
catch (PresentableException e)
|