# HG changeset patch # User robcast # Date 1292326473 -3600 # Node ID ec41f4bdda1f8f8e804508a64f1a47f842ff9625 # Parent 9a2494e6069cf6bc6d05c33f55518205a253d33e more refactoring and cleanup diff -r 9a2494e6069c -r ec41f4bdda1f servlet/src/digilib/servlet/PDFCache.java --- a/servlet/src/digilib/servlet/PDFCache.java Tue Dec 14 09:10:20 2010 +0100 +++ b/servlet/src/digilib/servlet/PDFCache.java Tue Dec 14 12:34:33 2010 +0100 @@ -56,10 +56,7 @@ public static Integer STATUS_ERROR = 3; // an error occurred while processing the request - public static String version = "0.2"; - - private ServletContext context = null; - + public static String version = "0.3a"; // TODO ? functionality for the pre-generation of complete books/chapters using default values @@ -73,7 +70,7 @@ logger.info("***** Digital Image Library Image PDF-Cache Servlet (version " + version + ") *****"); - context = config.getServletContext(); + ServletContext context = config.getServletContext(); dlConfig = (DigilibConfiguration) context.getAttribute("digilib.servlet.configuration"); if (dlConfig == null) { // no Configuration @@ -82,6 +79,10 @@ String temp_fn = dlConfig.getAsString("pdf-temp-dir"); temp_directory = new File(temp_fn); + if (!temp_directory.exists()) { + // try to create + temp_directory.mkdirs(); + } if (!temp_directory.isDirectory()) { throw new ServletException("Configuration error: problem with pdf-temp-dir="+temp_fn); } @@ -90,6 +91,10 @@ String cache_fn = dlConfig.getAsString("pdf-cache-dir"); cache_directory = new File(cache_fn); + if (!cache_directory.exists()) { + // try to create + cache_directory.mkdirs(); + } if (!cache_directory.isDirectory()) { throw new ServletException("Configuration error: problem with pdf-cache-dir="+cache_fn); } @@ -185,6 +190,7 @@ try { // forward to the relevant jsp + ServletContext context = request.getServletContext(); RequestDispatcher dispatch = context.getRequestDispatcher(jsp); dispatch.forward(request, response); } catch (ServletException e) {