# HG changeset patch # User robcast # Date 1098642230 -7200 # Node ID 0ddfc57a79afb8504eb5b3ad8ca79b6419df1ddb # Parent 1ecaf9c1fd8ad8474775401431b9e4ad487d2a3e 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 diff -r 1ecaf9c1fd8a -r 0ddfc57a79af servlet/src/digilib/servlet/ServletOps.java --- 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."); } diff -r 1ecaf9c1fd8a -r 0ddfc57a79af servlet/src/digilib/servlet/Texter.java --- 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 "