changeset 1442:270ffb3284a0 new_scaling

Merge from default c4d32640c1bebd2fb8b965ee97e745f9601f255e
author robcast
date Tue, 10 Nov 2015 15:42:35 +0100
parents 75ec39abcbba (current diff) c4d32640c1be (diff)
children e321607eb36e
files
diffstat 23 files changed, 159 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/common/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -15,21 +15,6 @@
 	<url>http://digilib.sourceforge.net</url>
 	<packaging>jar</packaging>
 	
-	<build>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>org.apache.maven.plugins</groupId>
-					<artifactId>maven-compiler-plugin</artifactId>
-					<configuration>
-						<source>1.7</source>
-						<target>1.7</target>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-	</build>
-
 	<profiles>
 		<profile>
 			<id>imageio-jai</id>
@@ -49,13 +34,11 @@
                     <type>jar</type>
                     <scope>compile</scope>
 				</dependency>
-				<!-- 
 				<dependency> 
 			         <groupId>com.github.jai-imageio</groupId> 
 			         <artifactId>jai-imageio-jpeg2000</artifactId> 
 				     <version>1.3.0</version> 
 				 </dependency> 
-				 -->
 			</dependencies>
 		</profile>
 		<profile>
--- a/common/src/main/java/digilib/conf/DigilibConfiguration.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/src/main/java/digilib/conf/DigilibConfiguration.java	Tue Nov 10 15:42:35 2015 +0100
@@ -57,7 +57,7 @@
 
     /** digilib version */
     public static String getClassVersion() {
-        return "2.3.3";
+        return "2.3.4a";
     }
 
     /* non-static getVersion for Java inheritance */
--- a/common/src/main/java/digilib/conf/DigilibRequest.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/src/main/java/digilib/conf/DigilibRequest.java	Tue Nov 10 15:42:35 2015 +0100
@@ -463,8 +463,8 @@
                     float h = Float.parseFloat(parms[3]);
                     setValue("wh", h / 100f);
                 } catch (Exception e) {
-                    errorMessage = "Error parsing range parameter in IIIF path!";
-                    logger.error(errorMessage, e);
+                    errorMessage = "Error parsing range parameter in IIIF path! ";
+                    logger.error(errorMessage+e);
                     return false;
                 }
             } else {
@@ -503,8 +503,8 @@
                     options.setOption("ascale");
                     setValue("scale", pct / 100);
                 } catch (NumberFormatException e) {
-                    errorMessage = "Error parsing size parameter in IIIF path!";
-                    logger.error(errorMessage, e);
+                    errorMessage = "Error parsing size parameter in IIIF path! ";
+                    logger.error(errorMessage+e);
                     return false;
                 }
             } else {
@@ -530,8 +530,8 @@
                         setValueFromString("dh", parms[1]);
                     }
                 } catch (Exception e) {
-                    errorMessage = "Error parsing size parameter in IIIF path!";
-                    logger.error(errorMessage, e);
+                    errorMessage = "Error parsing size parameter in IIIF path! ";
+                    logger.error(errorMessage+e);
                     return false;
                 }
             }
@@ -550,8 +550,8 @@
                 float rot = Float.parseFloat(rotation);
                 setValue("rot", rot);
             } catch (NumberFormatException e) {
-                errorMessage = "Error parsing rotation parameter in IIIF path!";
-                logger.error(errorMessage, e);
+                errorMessage = "Error parsing rotation parameter in IIIF path! ";
+                logger.error(errorMessage+e);
                 return false;
             }
         }
--- a/common/src/main/java/digilib/image/ImageJobDescription.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/src/main/java/digilib/image/ImageJobDescription.java	Tue Nov 10 15:42:35 2015 +0100
@@ -141,6 +141,7 @@
      */
     public static ImageJobDescription getInstance(DigilibRequest dlReq, DigilibConfiguration dlcfg) {
         ImageJobDescription newMap = new ImageJobDescription(dlcfg);
+        newMap.initParams();
         // add all params to this map
         newMap.params.putAll(dlReq.getParams());
         newMap.initOptions();
@@ -159,6 +160,7 @@
      */
     public static ImageJobDescription getInstance(ParameterMap pm, DigilibConfiguration dlcfg) {
         ImageJobDescription newMap = new ImageJobDescription(dlcfg);
+        newMap.initParams();
         // add all params to this map
         newMap.params.putAll(pm.getParams());
         newMap.initOptions();
@@ -585,6 +587,9 @@
 	        ImageSet fileset = getImageSet();
 	        ImageInput hiresFile = fileset.getBiggest();
 	        hiresSize = hiresFile.getSize();
+	        if (hiresSize == null) {
+	        	throw new FileOpException("Can't get size from hires image file!");
+	        }
         }
         return hiresSize;
     }
@@ -793,7 +798,9 @@
     public Rectangle2D getOuterImgArea() throws IOException, ImageOpException {
         if (outerImgArea == null) {
         	// calculate scale parameters
-        	prepareScaleParams();
+        	if (imgArea == null) {
+        		prepareScaleParams();
+        	}
             // start with imgArea
             outerImgArea = imgArea;
 
--- a/common/src/main/java/digilib/image/ImageLoaderDocuImage.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/src/main/java/digilib/image/ImageLoaderDocuImage.java	Tue Nov 10 15:42:35 2015 +0100
@@ -274,7 +274,7 @@
             return input;
         } catch (FileOpException e) {
             // maybe just our class doesn't know what to do
-            logger.error("ImageLoaderDocuimage unable to identify:", e);
+            logger.error("ImageLoaderDocuimage unable to identify: "+e);
             return null;
         } finally {
             if (!reuseReader && reader != null) {
@@ -481,8 +481,22 @@
         } catch (IOException e) {
             logger.error("Error writing image:", e);
             throw new FileOpException("Error writing image!", e);
+        } finally {
+        	if (writer != null) {
+        		writer.dispose();
+        	}
+        	if (imgout != null) {
+        		/* 
+        		 * ImageOutputStream likes to keep ServletOutputStream and close it when disposed.
+        		 * Thanks to Tom Van Wietmarschen's mail to tomcat-users on July 4, 2008!
+        		 */
+        		try {
+					imgout.close();
+				} catch (IOException e) {
+					logger.error("Error closing ImageOutputStream!", e);
+				}
+        	}
         }
-        // TODO: should we: finally { writer.dispose(); }
     }
 
     /* 
@@ -511,14 +525,24 @@
         double deltaX = targetW - Math.floor(targetW);
         double deltaY = targetH - Math.floor(targetH);
         if (deltaX > epsilon) {
-        	// round up
-        	logger.debug("rounding up x scale factor");
-            scaleX += (1 - deltaX) / imgW;
+        	// round x
+            if (deltaX > 0.5d) {
+                logger.debug("rounding up x scale factor");
+                scaleX += (1 - deltaX) / imgW;
+            } else {
+                logger.debug("rounding down x scale factor");
+                scaleX -= deltaX / imgW;
+            }
         }
         if (deltaY > epsilon) {
-        	// round up
-        	logger.debug("rounding up y scale factor");
-            scaleY += (1 - deltaY) / imgH;
+            // round y
+            if (deltaY > 0.5d) {
+                logger.debug("rounding up y scale factor");
+                scaleY += (1 - deltaY) / imgH;
+            } else {
+                logger.debug("rounding down y scale factor");
+                scaleY -= deltaY / imgH;
+            }
         }
         // scale with AffineTransformOp
         logger.debug("scaled from " + imgW + "x" + imgH + " img=" + img);
--- a/common/src/main/java/digilib/meta/IndexMetaDirMeta.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/common/src/main/java/digilib/meta/IndexMetaDirMeta.java	Tue Nov 10 15:42:35 2015 +0100
@@ -32,7 +32,6 @@
 import digilib.io.Directory;
 import digilib.io.DocuDirectory;
 import digilib.io.DocuDirent;
-import digilib.io.FileOps.FileClass;
 
 /**
  * DirMeta implementation reading index.meta files.
--- a/doc/src/site/markdown/iiif-api.md	Tue Oct 27 11:21:32 2015 +0100
+++ b/doc/src/site/markdown/iiif-api.md	Tue Nov 10 15:42:35 2015 +0100
@@ -2,7 +2,7 @@
 
 The Scaler servlet provides not only its native [Scaler API](scaler-api.html) but also an API compliant to the standards of the International Image Interoperability Framework http://iiif.io.
 
-As of version 2.3 digilib supports the [IIIF Image API version 1.1](http://iiif.io/api/image/1.1/) at [compliance level 2](http://iiif.io/api/image/1.1/compliance.html) (except for forced w,h sizes where the image would be distorted).
+As of version 2.3 digilib supports the [IIIF Image API version 1.1](http://iiif.io/api/image/1.1/) at [compliance level 2](http://iiif.io/api/image/1.1/compliance.html) (since V2.3.3 even for forced w,h sizes where the image will be distorted).
 
 IIIF Image API URLs for an image request have the form:
 
--- a/pdf/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/pdf/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -11,11 +11,11 @@
 	<description>The Digital Image Library - PDF generation servlet</description>
 	<url>http://digilib.sourceforge.net</url>
 	<repositories>
-    <repository>
+    <!-- <repository>
       <id>itextpdf.com</id>
       <name>Maven Repository for iText</name>
       <url>http://maven.itextpdf.com/</url>
-    </repository>
+    </repository> -->
     </repositories>
 	<dependencies>
 		<dependency>
@@ -27,7 +27,7 @@
 		<dependency>
 			<groupId>com.itextpdf</groupId>
 			<artifactId>itextpdf</artifactId>
-	        <version>5.5.5</version>
+	        <version>5.5.7</version>
 			<type>jar</type>
 			<scope>compile</scope>
 		</dependency>
@@ -57,7 +57,7 @@
 				<dependency>
 					<groupId>javax.servlet</groupId>
 					<artifactId>servlet-api</artifactId>
-					<version>2.3</version>
+					<version>2.4</version>
 					<type>jar</type>
 					<scope>provided</scope>
 				</dependency>
--- a/pdf/src/main/java/digilib/conf/PDFRequest.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/pdf/src/main/java/digilib/conf/PDFRequest.java	Tue Nov 10 15:42:35 2015 +0100
@@ -32,11 +32,9 @@
 
 import org.apache.log4j.Logger;
 
-import digilib.conf.DigilibConfiguration;
 import digilib.image.ImageJobDescription;
 import digilib.io.DocuDirectory;
 import digilib.io.FileOpException;
-import digilib.io.FileOps.FileClass;
 import digilib.util.NumRange;
 import digilib.util.OptionsSet;
 import digilib.util.ParameterMap;
@@ -59,18 +57,18 @@
 
 	
 	/**
-	 * Initialize the PDFJobInformation
+	 * Initialize the PDFRequest
 	 * 
-	 * @param dlcfg			
-	 * 						The DigilibConfiguration. 
+	 * @param dlcfg	The DigilibConfiguration. 
 	 */
 	public PDFRequest(DigilibConfiguration dlcfg) {
 		super(30);
 		dlConfig = dlcfg;
+		initParams();
 	}
 
 	/**
-	 * Initialize the PDFJobInformation with a request.
+	 * Initialize the PDFRequest with a request.
 	 * 
 	 * @param dlcfg		The DigilibConfiguration. 		
 	 * @param request
@@ -79,7 +77,8 @@
 	public PDFRequest(HttpServletRequest request, DigilibConfiguration dlcfg) throws FileOpException {
 		super(30);
 		dlConfig = dlcfg;
-		this.setWithRequest(request);
+		initParams();
+		setWithRequest(request);
 	}
 
 	
@@ -119,7 +118,7 @@
 		pages = new NumRange(getAsString("pgs"));
         ImageJobDescription ij = ImageJobDescription.getInstance(this, dlConfig);
         DocuDirectory dir = ij.getFileDirectory();
-        int dirsize = dir.size(FileClass.IMAGE);
+        int dirsize = dir.size();
         pages.setMaxnum(dirsize);
 	}
 	
--- a/pdf/src/main/java/digilib/conf/PDFServletConfiguration.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/pdf/src/main/java/digilib/conf/PDFServletConfiguration.java	Tue Nov 10 15:42:35 2015 +0100
@@ -55,7 +55,7 @@
     public static final String PDF_CACHEDIR_KEY = "pdf.servlet.cache.dir";
 
     public static String getClassVersion() {
-        return "2.3.0 pdf";
+        return DigilibServletConfiguration.getClassVersion() + " pdf";
     }
 
     /* non-static getVersion for Java inheritance */
--- a/pdf/src/main/java/digilib/pdf/PDFStreamWorker.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/pdf/src/main/java/digilib/pdf/PDFStreamWorker.java	Tue Nov 10 15:42:35 2015 +0100
@@ -176,7 +176,7 @@
 		Image pdfimg = Image.getInstance(img.getAwtImage(), null);
 		float docW = PageSize.A4.getWidth() - 2 * PageSize.A4.getBorder();
 		float docH = PageSize.A4.getHeight() - 2 * PageSize.A4.getBorder();
-		// TODO: do we really scale this again?
+		// fit the image to the page
 		pdfimg.scaleToFit(docW, docH);
 		// add to PDF
 		doc.add(pdfimg);
--- a/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -101,6 +101,10 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.3</version>
+            <configuration>
+                <source>1.7</source>
+                <target>1.7</target>
+            </configuration>
         </plugin>
       </plugins>
     </pluginManagement>
--- a/servlet/src/main/java/digilib/servlet/ServletOps.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/servlet/src/main/java/digilib/servlet/ServletOps.java	Tue Nov 10 15:42:35 2015 +0100
@@ -301,7 +301,9 @@
     }
 
     /**
-     * Write image img to ServletResponse response.
+     * Write image img to ServletResponse response as data of mimeType.
+     * 
+     * If mimeType is null, use heuristics for type.
      * 
      * @param img
      * @param mimeType
@@ -317,13 +319,12 @@
     		logger.error("No response!");
     		return;
     	}
-        //logger.debug("sending to response: ("+ headersToString(response) + ") committed=" + response.isCommitted());
         logger.debug("sending to response. committed=" + response.isCommitted());
-        // TODO: should we erase or replace old last-modified header?
         try {
-            OutputStream outstream = response.getOutputStream();
-            // setup output -- if mime type is set use that otherwise
-            // if source is JPG then dest will be JPG else it's PNG
+            /*
+             * determine the content-type: if mime type is set use that 
+             * otherwise if source is JPG then dest will be JPG else it's PNG
+             */
             if (mimeType == null) {
                 mimeType = img.getMimetype();
                 if (mimeType == null) {
@@ -338,13 +339,28 @@
             } else {
                 mimeType = "image/png";
             }
-            // write the image
+            // set the content type
             response.setContentType(mimeType);
+            String respType = response.getContentType();
+            if (! mimeType.equals(respType)) {
+            	// this shouldn't happen
+            	logger.error("Crap! ServletResponse lost content type! ["+respType+"] Aborting!");
+            	// TODO: would this even help?
+            	response.getOutputStream().close();
+            	return;
+            }
+            
+            /*
+             * write the image
+             */
+            OutputStream outstream = response.getOutputStream();
             img.writeImage(mimeType, outstream);
+            
         } catch (IOException e) {
             throw new ServletException("Error sending image:", e);
-        }
-        // TODO: should we: finally { img.dispose(); }
+        } finally { 
+        	img.dispose(); 
+    	}
     }
 
 
--- a/servlet3/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/servlet3/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -7,20 +7,7 @@
   </parent>
   <artifactId>digilib-servlet3</artifactId>
   <name>digilib-servlet3</name>
-  <build>
-  	<pluginManagement>
-  		<plugins>
-  			<plugin>
-  				<groupId>org.apache.maven.plugins</groupId>
-  				<artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target> 
-                </configuration>
-  			</plugin>
-  		</plugins>
-  	</pluginManagement>
-  </build>
+
   <dependencies>
   	<dependency>
   		<groupId>org.mortbay.jetty</groupId>
--- a/servlet3/src/main/java/digilib/servlet/AsyncServletWorker.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/servlet3/src/main/java/digilib/servlet/AsyncServletWorker.java	Tue Nov 10 15:42:35 2015 +0100
@@ -54,10 +54,10 @@
 public class AsyncServletWorker implements Runnable, AsyncListener {
 
     /** the AsyncServlet context */
-    private AsyncContext asyncContext;
+    private AsyncContext asyncContext = null;
 
     /** the ImageWorker we use */
-    private ImageWorker imageWorker;
+    private ImageWorker imageWorker = null;
 
     protected static Logger logger = Logger.getLogger(AsyncServletWorker.class);
     private long startTime;
@@ -92,22 +92,29 @@
     @Override
     public void run() {
         try {
-            // render the image
+            /*
+             * render the image
+             */
             DocuImage img = imageWorker.call();
             if (completed) {
                 logger.debug("AsyncServletWorker already completed (after scaling)!");
                 return;
             }
-            // forced destination image type
+            /*
+             * set forced destination image type
+             */
             String mt = null;
             if (jobinfo.hasOption("jpg")) {
                 mt = "image/jpeg";
             } else if (jobinfo.hasOption("png")) {
                 mt = "image/png";
             }
-            // send image
-            ServletOps.sendImage(img, mt,
-                    (HttpServletResponse) asyncContext.getResponse(), logger);
+            /*
+             *  send the image
+             */
+            HttpServletResponse response = (HttpServletResponse) asyncContext.getResponse();
+            ServletOps.sendImage(img, mt, response, logger);
+            
             logger.debug("Job done in: "
                     + (System.currentTimeMillis() - startTime) + "ms");
         } catch (ImageOpException e) {
@@ -128,7 +135,7 @@
             } else {
                 // submit response
                 logger.debug("context complete.");
-                this.completed = true;
+                completed = true;
                 asyncContext.complete();
             }
         }
@@ -144,7 +151,7 @@
     public void onComplete(AsyncEvent event) throws IOException {
         logger.debug("AsyncServletWorker onComplete");
         // make sure complete isn't called twice
-        this.completed = true;
+        completed = true;
     }
 
     @Override
@@ -155,7 +162,7 @@
             return;
         }
         imageWorker.stopNow();
-        this.completed = true;
+        completed = true;
         Scaler.digilibError(errMsgType, Error.UNKNOWN, null,
                 (HttpServletResponse) asyncContext.getResponse());
         asyncContext.complete();
@@ -171,7 +178,7 @@
             return;
         }
         imageWorker.stopNow();
-        this.completed = true;
+        completed = true;
         Scaler.digilibError(errMsgType, Error.UNKNOWN, "ERROR: timeout rendering image!",
                 (HttpServletResponse) asyncContext.getResponse());
         asyncContext.complete();
--- a/servlet3/src/main/java/digilib/servlet/Scaler.java	Tue Oct 27 11:21:32 2015 +0100
+++ b/servlet3/src/main/java/digilib/servlet/Scaler.java	Tue Nov 10 15:42:35 2015 +0100
@@ -229,8 +229,10 @@
         accountlog.debug("request: " + request.getQueryString());
         logger.debug("request: " + request.getQueryString());
         //logger.debug("headers: " + ServletOps.headersToString(request));
-        // logger.debug("response:"+ response + " committed=" +
-        // response.isCommitted());
+        //logger.debug("processRequest response committed=" + response.isCommitted());
+        if (response.isCommitted()) {
+        	logger.error("Crap: response committed before we got a chance!");
+        }
         final long startTime = System.currentTimeMillis();
 
         // parse request
@@ -262,11 +264,13 @@
         
         try {
             /*
-             * check if we can fast-track without scaling
+             * get the input file
              */
             ImageInput fileToLoad = (ImageInput) jobTicket.getInput();
 
-            // check permissions
+            /*
+             * check permissions
+             */
             if (useAuthorization) {
                 // is the current request/user authorized?
                 if (!authOp.isAuthorized(dlRequest)) {
@@ -275,10 +279,13 @@
                 }
             }
 
-            // if requested, send image as a file
+            /*
+             * if requested, send image as a file
+             */
             if (sendFileAllowed && jobTicket.getSendAsFile()) {
                 String mt = null;
                 if (jobTicket.hasOption("rawfile")) {
+                	// mo=rawfile sends as octet-stream
                     mt = "application/octet-stream";
                 }
                 logger.debug("Sending RAW File as is.");
@@ -287,7 +294,9 @@
                 return;
             }
 
-            // if possible, send the image without actually having to transform it
+            /*
+             * send the image if it's possible without having to transform it
+             */
             if (!jobTicket.isTransformRequired()) {
                 logger.debug("Sending File as is.");
                 ServletOps.sendFile(fileToLoad.getFile(), null, null, response, logger);
@@ -295,15 +304,19 @@
                 return;
             }
 
-            // check load of workers
+            /*
+             * check load of workers
+             */
             if (imageJobCenter.isBusy()) {
                 logger.error("Servlet overloaded!");
                 response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
                 return;
             }
 
-            // worker job is done asynchronously
-            AsyncContext asyncCtx = request.startAsync(request, response);
+            /*
+             * dispatch worker job to be done asynchronously
+             */
+            AsyncContext asyncCtx = request.startAsync();
             // create job
             AsyncServletWorker job = new AsyncServletWorker(dlConfig, jobTicket, asyncCtx, errMsgType, startTime);
             // AsyncServletWorker is its own AsyncListener
@@ -348,7 +361,7 @@
                 status = HttpServletResponse.SC_FORBIDDEN;
             } else if (error == Error.FILE) {
                 if (msg == null) {
-                    msg = "ERROR: Image file not found!";
+                    msg = "ERROR: Image file not found or image not readable!";
                 }
                 img = notfoundImgFile;
                 status = HttpServletResponse.SC_NOT_FOUND;
--- a/text/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/text/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -38,7 +38,7 @@
 				<dependency>
 					<groupId>javax.servlet</groupId>
 					<artifactId>servlet-api</artifactId>
-					<version>2.3</version>
+					<version>2.4</version>
 					<type>jar</type>
 					<scope>provided</scope>
 				</dependency>
--- a/webapp/pom.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/pom.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -14,10 +14,6 @@
 	<url>http://digilib.sourceforge.net</url>
 	<packaging>war</packaging>
 
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-	</properties>
-
 	<build>
 		<pluginManagement>
 			<plugins>
--- a/webapp/src/main/webapp/WEB-INF/web-2.4.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/src/main/webapp/WEB-INF/web-2.4.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
- 
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+     version="2.4">
+     
   <!-- General description of your web application -->
   <display-name>
         digilib
--- a/webapp/src/main/webapp/WEB-INF/web-3.0.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/src/main/webapp/WEB-INF/web-3.0.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app
-        version="3.0"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+        version="3.0">
         
   <!-- General description of your web application -->
   <display-name>
--- a/webapp/src/main/webapp/WEB-INF/web-additional.xml	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/src/main/webapp/WEB-INF/web-additional.xml	Tue Nov 10 15:42:35 2015 +0100
@@ -40,6 +40,10 @@
     <!-- The mapping for the PDFCache servlet -->
     <servlet-mapping>
         <servlet-name>PDFCache</servlet-name>
+        <url-pattern>/PDFCache/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>PDFCache</servlet-name>
         <url-pattern>/servlet/PDFCache/*</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Tue Nov 10 15:42:35 2015 +0100
@@ -45,7 +45,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.3.0-2',
+        'version' : 'jquery.digilib.js 2.3.4a',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
--- a/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js	Tue Oct 27 11:21:32 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js	Tue Nov 10 15:42:35 2015 +0100
@@ -151,13 +151,14 @@
 
     // update preview values for a given slider
     var updatePreview = function ($slider) {
-        if ($slider == null) return;
-        var cls = $slider.data('cls');
+        if ($slider == null) {
+            return;
+            }
         var $preview = $slider.data('preview');
         if ($preview == null) {
-            console.error("slider updatePreview without preview!");
             return;
-        }
+            }
+        var cls = $slider.data('cls');
         var $td2 = $preview.find('table.'+cls+'preview td');
         // account for current brgt/cont/rgbm/rgba values
         var calcRGBValue = function (code, val) {
@@ -168,7 +169,7 @@
             var brgt = colorVals.brgt;
             var resultVal = cont + brgt;
             return Math.min(Math.max(Math.round(resultVal), 0), 255);
-           };
+            };
         // color one table cell according to index position
         var setRGBValues = function (index) {
             var val = index * 32;
@@ -340,12 +341,12 @@
                 update($slider, val);
                 }
             };
-        var reset = function () {
+        var resetToStartvalue = function () {
             $text.val(startvalue);
             textChange();
             };
-        var resetdefault = function () {
-            $text.val(opts.start);
+        var resetToDefaultvalue = function () {
+            $text.val(options.start);
             textChange();
             };
         // connect slider and input
@@ -354,8 +355,8 @@
         $slider.data({
             '$text' : $text,
             '$range' : $range,
-            'reset' : reset,
-            'default' : resetdefault,
+            'reset' : resetToStartvalue,
+            'default' : resetToDefaultvalue,
             'update' : null
         });
         return $slider;
@@ -434,7 +435,7 @@
             var rgba = input['ra'].val() + '/' + input['ga'].val() + '/' + input['ba'].val();
             var rgbm = input['rm'].val() + '/' + input['gm'].val() + '/' + input['bm'].val();
             if (typeof onSubmit === 'function') {
-                (rgbm, rgba);
+                onSubmit(rgbm, rgba);
                 }
             };
         $.each(primaryColors, insertTableRow);