changeset 499:87d2ed21bdec Root_digilibPDF

changed generation of documentID in PDFCache
author cmielack
date Fri, 13 Feb 2009 11:08:19 +0100
parents 86b5589f38db
children aa39692dd0f8
files servlet/src/digilib/servlet/MakePDF.java servlet/src/digilib/servlet/PDFCache.java
diffstat 2 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/MakePDF.java	Wed Feb 11 17:02:48 2009 +0100
+++ b/servlet/src/digilib/servlet/MakePDF.java	Fri Feb 13 11:08:19 2009 +0100
@@ -263,7 +263,7 @@
 			cache_hash.put(file_only, 2); // register the file as 'pending'
 	
 			// TODO check, if file can be created without overwriting another file etc.
-			
+
 			fos = new FileOutputStream(filename);
 			
 			pdfOutStream = generatePDFcontent(request, response, this.getServletContext(), fos);
--- a/servlet/src/digilib/servlet/PDFCache.java	Wed Feb 11 17:02:48 2009 +0100
+++ b/servlet/src/digilib/servlet/PDFCache.java	Fri Feb 13 11:08:19 2009 +0100
@@ -84,10 +84,13 @@
 	
 	public String getDocumentId(HttpServletRequest request){
 		// generate an unambiguous ID from the request (this is used for filenames etc)
-		// at this stage, the request-string is used
 		String id;
+
+		String fn = request.getParameter("fn");
+		String dh = request.getParameter("dh");
+		String pgs = request.getParameter("pgs");
 		
-		id = request.getQueryString() + ".pdf";		
+		id = "fn=" + fn + "&dh=" + dh + "&pgs=" + pgs + ".pdf";		
 
 		return id;
 	}
@@ -112,19 +115,12 @@
 		
 		else if (status == STATUS_PENDING){
 		// ... if it is in the works, notify the user about it ...
-			String redir_url = "abc.jsp";
-			try {
-				response.sendRedirect(redir_url);
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
 		}
 		else if (status == STATUS_NONEXISTENT){
 		// ... or else, generate the file and inform the user about the estimated generation-time
 			try {
 				createFile(request, response);
-				response.sendRedirect(request.getRequestURI()+'?'+request.getQueryString());  // refresh the browser after finishing the file
+				response.sendRedirect(request.getRequestURI()+'?'+request.getQueryString()+"&done=true");  // refresh the browser after finishing the file
 			} catch (ServletException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();