Mercurial > hg > digilib-old
changeset 299:0ddfc57a79af
Servlet version 1.5.0b -- the beginning of the next generation :-)
- code restructuring to improve scaleability
- new Initialiser servlet that must be run first
- image transformation work moved to DigilibImageWorker class
- Maximum number of concurrent threads limited by Semaphore
- old JIMI toolkit implementation removed
author | robcast |
---|---|
date | Sun, 24 Oct 2004 20:23:50 +0200 |
parents | 1ecaf9c1fd8a |
children | 3baaf11898d2 |
files | servlet/src/digilib/servlet/ServletOps.java servlet/src/digilib/servlet/Texter.java |
diffstat | 2 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/ServletOps.java Sun Oct 24 20:23:50 2004 +0200 +++ b/servlet/src/digilib/servlet/ServletOps.java Sun Oct 24 20:23:50 2004 +0200 @@ -63,8 +63,8 @@ /** * get a real File for a config File. * - * If the File is not absolute the path is - * appended to the WEB-INF directory of the web-app. + * If the File is not absolute the path is appended to the WEB-INF directory + * of the web-app. * * @param file * @param sc @@ -74,8 +74,8 @@ // is the filename absolute? if (!f.isAbsolute()) { // relative path -> use getRealPath to resolve in WEB-INF - String fn = sc.getServletContext() - .getRealPath("WEB-INF/" + f.getPath()); + String fn = sc.getServletContext().getRealPath( + "WEB-INF/" + f.getPath()); f = new File(fn); } return f; @@ -140,8 +140,8 @@ * @throws FileOpException * Exception is thrown for a IOException. */ - public static void sendFile(File f, String mt, HttpServletResponse response) - throws FileOpException { + public static void sendFile(File f, String mt, + HttpServletResponse response) throws FileOpException { logger.debug("sendRawFile(" + mt + ", " + f + ")"); if (mt == null) { // auto-detect mime-type @@ -154,7 +154,8 @@ // open file try { if (mt.equals("application/octet-stream")) { - response.addHeader("Content-Disposition", "attachment; filename=\""+f.getName()+"\""); + response.addHeader("Content-Disposition", + "attachment; filename=\"" + f.getName() + "\""); } FileInputStream inFile = new FileInputStream(f); OutputStream outStream = response.getOutputStream(); @@ -165,6 +166,7 @@ outStream.write(dataBuffer, 0, len); } inFile.close(); + response.flushBuffer(); } catch (IOException e) { throw new FileOpException("Unable to send file."); }
--- a/servlet/src/digilib/servlet/Texter.java Sun Oct 24 20:23:50 2004 +0200 +++ b/servlet/src/digilib/servlet/Texter.java Sun Oct 24 20:23:50 2004 +0200 @@ -85,13 +85,8 @@ dlConfig = (DigilibConfiguration) context .getAttribute("digilib.servlet.configuration"); if (dlConfig == null) { - // create new Configuration - try { - dlConfig = new DigilibConfiguration(config); - context.setAttribute("digilib.servlet.configuration", dlConfig); - } catch (Exception e) { - throw new ServletException(e); - } + // no Configuration + throw new ServletException("No Configuration!"); } // say hello in the log file logger.info("***** Digital Image Library Text Servlet (version "