changeset 341:d10e4ce2a153

Servlet version 1.5.4b - filenames with dots (brr...) work when given without extension
author robcast
date Wed, 17 Nov 2004 19:30:34 +0100
parents d50fefb90edb
children 84bfba8a1c9e
files client/digitallibrary/WEB-INF/lib/DigilibServlet.jar servlet/src/digilib/io/DocuDirectory.java servlet/src/digilib/servlet/DigilibRequest.java servlet/src/digilib/servlet/Scaler.java
diffstat 4 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
Binary file client/digitallibrary/WEB-INF/lib/DigilibServlet.jar has changed
--- a/servlet/src/digilib/io/DocuDirectory.java	Thu Nov 04 17:06:13 2004 +0100
+++ b/servlet/src/digilib/io/DocuDirectory.java	Wed Nov 17 19:30:34 2004 +0100
@@ -425,21 +425,16 @@
 		} else {
 			// try closest matches without extension
 			idx = -idx - 1;
-			String fb = FileOps.basename(fn);
-			DocuDirent fs;
 			if ((idx < fileList.size())
-					&& (FileOps.basename(((DocuDirent) fileList.get(idx))
-							.getName()).equals(fb))) {
+					&& isBaseInList(fileList, idx, fn)) {
 				// idx matches
 				return idx;
 			} else if ((idx > 0)
-					&& (FileOps.basename(((DocuDirent) fileList.get(idx - 1))
-							.getName()).equals(fb))) {
+					&& isBaseInList(fileList, idx-1, fn)) {
 				// idx-1 matches
 				return idx - 1;
 			} else if ((idx + 1 < fileList.size())
-					&& (FileOps.basename(((DocuDirent) fileList.get(idx - 1))
-							.getName()).equals(fb))) {
+					&& isBaseInList(fileList, idx+1, fn)) {
 				// idx+1 matches
 				return idx + 1;
 			}
@@ -448,6 +443,13 @@
 		return -1;
 	}
 
+	private boolean isBaseInList(List fl, int idx, String fn) {
+		String dfn = FileOps.basename(((DocuDirent) fl.get(idx))
+				.getName());
+		return (dfn.equals(fn)||dfn.equals(FileOps.basename(fn))); 
+	}
+	
+	
 	/**
 	 * Finds the DocuDirent with the name <code>fn</code>.
 	 * 
--- a/servlet/src/digilib/servlet/DigilibRequest.java	Thu Nov 04 17:06:13 2004 +0100
+++ b/servlet/src/digilib/servlet/DigilibRequest.java	Wed Nov 17 19:30:34 2004 +0100
@@ -442,7 +442,7 @@
 			StringReader sr = new StringReader(strRDF);
 			model.read(sr, "");
 			// get Property type -> digilib
-			Property property = model.getProperty(this.ECHO, "type");
+			Property property = model.getProperty(DigilibRequest.ECHO, "type");
 			if(property != null) {
 				ResIterator resourceIterator = model.listSubjectsWithProperty(property);
 				while(resourceIterator.hasNext()) {
@@ -452,11 +452,11 @@
 					if(type == null) {
 						continue;
 					}
-					if(type.equals(this.ECHO+this.DIGILIB)) {
+					if(type.equals(DigilibRequest.ECHO+DigilibRequest.DIGILIB)) {
 						while(statementIterator.hasNext()) {
 							Statement statement = statementIterator.next();
 							Property predicate = statement.getPredicate();
-							if(predicate.getNameSpace().equals(this.ECHO)) {
+							if(predicate.getNameSpace().equals(DigilibRequest.ECHO)) {
 								hashParams.put(predicate.getLocalName(),statement.getObject().toString());
 							}
 						}
--- a/servlet/src/digilib/servlet/Scaler.java	Thu Nov 04 17:06:13 2004 +0100
+++ b/servlet/src/digilib/servlet/Scaler.java	Wed Nov 17 19:30:34 2004 +0100
@@ -59,7 +59,7 @@
 	private static final long serialVersionUID = -325080527268912852L;
 
 	/** digilib servlet version (for all components) */
-	public static final String dlVersion = "1.5.3b";
+	public static final String dlVersion = "1.5.4b";
 
 	/** logger for accounting requests */
 	private static Logger accountlog = Logger.getLogger("account.request");