# HG changeset patch # User robcast # Date 1292326473 -3600 # Node ID f9a4288fc7c416cc455ec2718aec07df833ddc09 # Parent b86a7b700bc311aeef3d89f0aad78a281b711937 more refactoring and cleanup diff -r b86a7b700bc3 -r f9a4288fc7c4 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) {