changeset 357:e03b4d7a7b46

better version of SVG Raster servlet
author robcast
date Tue, 06 Dec 2005 14:36:31 +0100
parents 12e3dd21c4cd
children 28f6030aa470
files servlet/src/digilib/servlet/Raster.java
diffstat 1 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/Raster.java	Tue Oct 25 20:39:48 2005 +0200
+++ b/servlet/src/digilib/servlet/Raster.java	Tue Dec 06 14:36:31 2005 +0100
@@ -44,6 +44,8 @@
 
 import digilib.auth.AuthOps;
 import digilib.io.DocuDirCache;
+import digilib.io.DocuDirectory;
+import digilib.io.DocuDirent;
 import digilib.io.FileOpException;
 import digilib.io.FileOps;
 import digilib.io.SVGFile;
@@ -59,7 +61,7 @@
 	private static final long serialVersionUID = -7756999389932675241L;
 
 	/** Servlet version */
-	public static String servletVersion = "0.1b1";
+	public static String servletVersion = "0.2b1";
 	/** DigilibConfiguration instance */
 	DigilibConfiguration dlConfig = null;
 	/** general logger */
@@ -157,6 +159,39 @@
 		processRequest(request, response);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.servlet.http.HttpServlet#getLastModified(javax.servlet.http.HttpServletRequest)
+	 */
+	protected long getLastModified(HttpServletRequest request) {
+		logger.debug("GetLastModified from " + request.getRemoteAddr()
+				+ " for " + request.getQueryString());
+		long mtime = -1;
+		// create new request with defaults
+		DigilibRequest dlReq = new DigilibRequest();
+		// set with request parameters
+		dlReq.setWithRequest(request);
+		// find the requested file
+		
+		// get PathInfo
+		String loadPathName = dlReq.getFilePath();
+		// find the file(set)
+		SVGFile fileToLoad =
+			(SVGFile) dirCache.getFile(
+				loadPathName,
+				dlReq.getAsInt("pn"),
+				FileOps.CLASS_SVG);
+		if (fileToLoad != null) {
+			DocuDirectory dd = (DocuDirectory) fileToLoad.getParent();
+			mtime = dd.getDirMTime() / 1000 * 1000;
+		}
+		return mtime;
+	}
+
+	
+	
+	
 	protected void processRequest(
 		HttpServletRequest request,
 		HttpServletResponse response)
@@ -221,7 +256,8 @@
 			// get document width and height
 			float imgWidth = svgroot.getWidth().getBaseVal().getValue();
 			float imgHeight = svgroot.getHeight().getBaseVal().getValue();
-
+			logger.debug("IMG: "+imgWidth+"x"+imgHeight);
+			
 			/*
 			 * set up the transcoder
 			 */