Commit a0288d07 authored by cmielack's avatar cmielack

changed generation of documentID in PDFCache

parent 7be52fd1
...@@ -263,7 +263,7 @@ public class MakePDF extends HttpServlet implements Runnable{ ...@@ -263,7 +263,7 @@ public class MakePDF extends HttpServlet implements Runnable{
cache_hash.put(file_only, 2); // register the file as 'pending' cache_hash.put(file_only, 2); // register the file as 'pending'
// TODO check, if file can be created without overwriting another file etc. // TODO check, if file can be created without overwriting another file etc.
fos = new FileOutputStream(filename); fos = new FileOutputStream(filename);
pdfOutStream = generatePDFcontent(request, response, this.getServletContext(), fos); pdfOutStream = generatePDFcontent(request, response, this.getServletContext(), fos);
......
...@@ -84,10 +84,13 @@ public class PDFCache extends HttpServlet { ...@@ -84,10 +84,13 @@ public class PDFCache extends HttpServlet {
public String getDocumentId(HttpServletRequest request){ public String getDocumentId(HttpServletRequest request){
// generate an unambiguous ID from the request (this is used for filenames etc) // generate an unambiguous ID from the request (this is used for filenames etc)
// at this stage, the request-string is used
String id; 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; return id;
} }
...@@ -112,19 +115,12 @@ public class PDFCache extends HttpServlet { ...@@ -112,19 +115,12 @@ public class PDFCache extends HttpServlet {
else if (status == STATUS_PENDING){ else if (status == STATUS_PENDING){
// ... if it is in the works, notify the user about it ... // ... 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){ else if (status == STATUS_NONEXISTENT){
// ... or else, generate the file and inform the user about the estimated generation-time // ... or else, generate the file and inform the user about the estimated generation-time
try { try {
createFile(request, response); 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) { } catch (ServletException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment