aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-09 15:27:50 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-09 15:27:50 +0000
commiteb68e29e371ef3e944f682239e6f3f92cb084697 (patch)
tree39ef4547a7efe4e929886b3d2ca01bb037cb2ce4 /src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
parentdef55a4c6f4a26b8ddbf2a9e892e36a67d9380f1 (diff)
downloadpdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.tar.gz
pdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.tar.bz2
pdf-as-3-eb68e29e371ef3e944f682239e6f3f92cb084697.zip
Web-Application: Configuration may be declared via system property "pdf-as.work-dir" or via Servlet-Init-Parameter "work-dir".
Bug fixed in RetrieveSignatureDataServlet: Response header didn't contain a content length attribute. The ITS Mac BKU rejects those requests. Workaround for ITS Mac BKU integrated. A redirect via response does only work if the response contains a valid SL request (e.g. a NullOperationRequest). API: The configuration folder may be omitted at instantiating the api. Configuration may be set via system property "pdf-as.work-dir". If no configuration is given at all, the current user's home directory is searched for a folder "PDF-AS". If not found a default configuration is created. If the configuration is explicitely given than the temporary folder is located within the given directory otherwise within the user's temporary directory. Declaring the configuration folder, replacements for system properties like "${catalina.base}/conf/pdfas" may be used. Web-Application: Session is now being invalidated after download of the signed pdf file. Web-Application: Every hardcoded context "pdf-as" has been replaced. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@277 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
index adb31be..e33a5ec 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
@@ -17,15 +17,13 @@
*/
package at.knowcenter.wag.egov.egiz.web;
-import java.io.File;
-import java.io.IOException;
-
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
+import at.gv.egiz.pdfas.api.commons.Constants;
import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
@@ -44,6 +42,14 @@ public class PdfASServletContextListener implements ServletContextListener
* The logger.
*/
private static final Logger logger = ConfigLogger.getLogger(PdfASServletContextListener.class);
+
+
+ /**
+ * The servlet init parameter that may be used to declare the pdf-as configuration folder. The
+ * init parameter may be set in web.xml or in META-INF/context.xml resp.
+ * conf/Catalina/localhost/pdf-as.xml if deployed.
+ */
+ private final static String CONFIG_SERVLET_INIT_PARAMETER = "work-dir";
/**
* @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
@@ -52,19 +58,28 @@ public class PdfASServletContextListener implements ServletContextListener
{
logger.info("PDF-AS Context init"); //$NON-NLS-1$
- String sysPropWorkdir = System.getProperty("pdf-as.work-dir");
+ String sysPropWorkdir = System.getProperty(Constants.CONFIG_SYSTEM_PROPERTY);
+ String scWorkdir = sce.getServletContext().getInitParameter(CONFIG_SERVLET_INIT_PARAMETER);
+
String work_dir;
+
+ // search for system property
if (sysPropWorkdir != null && sysPropWorkdir.length() > 0) {
work_dir = sysPropWorkdir;
- logger.info("Work-dir configuration via system property.");
- logger.info("PDF-AS work-dir via system property = " + work_dir); //$NON-NLS-1$
+ logger.debug("Work-dir configuration via system property \"" + Constants.CONFIG_SYSTEM_PROPERTY + "\" = \"" + sysPropWorkdir + "\".");
+
+ // search for servlet parameter
+ } else if (scWorkdir != null && scWorkdir.length() > 0){
+ work_dir = scWorkdir;
+ logger.debug("Work-dir configuration via servlet init parameter \"" + CONFIG_SERVLET_INIT_PARAMETER + "\" = \"" + scWorkdir + "\".");
+
+ // assume configuration to be located in webapp path
} else {
- work_dir = sce.getServletContext().getInitParameter("work-dir"); //$NON-NLS-1$
- logger.info("PDF-AS work-dir context parameter = " + work_dir); //$NON-NLS-1$
+ work_dir = sce.getServletContext().getRealPath("/");
+ logger.debug("PDF-AS work-dir not explicitely given. Assuming configuration is located in webapp folder \"" + work_dir + "\".");
}
- String base_dir = sce.getServletContext().getRealPath("/"); //$NON-NLS-1$
- logger.info("PDF-AS real path = " + base_dir); //$NON-NLS-1$
+ logger.info("PDF-AS configuration location = \"" + work_dir + "\"");
// try
// {
@@ -76,13 +91,8 @@ public class PdfASServletContextListener implements ServletContextListener
// e.printStackTrace();
// }
- if (work_dir != null && work_dir.length() > 0)
- {
- base_dir = work_dir;
- }
- logger.info("The PDF-AS application will be initialized for the directory: " + base_dir);
- SettingsReader.initializeForWeb(base_dir);
+ SettingsReader.initializeForWeb(work_dir);
PropertyConfigurator.configure(SettingsReader.CONFIG_PATH + "log4j.properties");
SettingsReader.clearTemporaryDirectory();