Mercurial > hg > digilib-old
changeset 802:034ab33984d2 stream
check for ServletResponse.isCommited()
author | robcast |
---|---|
date | Sat, 19 Feb 2011 12:32:20 +0100 |
parents | 72662bb585ba |
children | 587c90bc5976 |
files | servlet/src/digilib/servlet/Scaler.java servlet/src/digilib/servlet/ServletOps.java |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/Scaler.java Sat Feb 19 11:07:08 2011 +0100 +++ b/servlet/src/digilib/servlet/Scaler.java Sat Feb 19 12:32:20 2011 +0100 @@ -30,7 +30,7 @@ public class Scaler extends HttpServlet { /** digilib servlet version (for all components) */ - public static final String version = "1.9.0a2"; + public static final String version = "1.9.0a3"; /** servlet error codes */ public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};
--- a/servlet/src/digilib/servlet/ServletOps.java Sat Feb 19 11:07:08 2011 +0100 +++ b/servlet/src/digilib/servlet/ServletOps.java Sat Feb 19 12:32:20 2011 +0100 @@ -222,6 +222,10 @@ public static void sendFile(File f, String mt, String name, HttpServletResponse response, Logger logger) throws ImageOpException, ServletException { logger.debug("sendRawFile(" + mt + ", " + f + ")"); + if (response.isCommitted()) { + logger.warn("sendFile: response already committed!"); + //return; + } if (mt == null) { // auto-detect mime-type mt = FileOps.mimeForFile(f); @@ -293,6 +297,10 @@ public static void sendImage(DocuImage img, String mimeType, HttpServletResponse response, Logger logger) throws ImageOpException, ServletException { + if (response.isCommitted()) { + logger.warn("sendImage: response already committed!"); + //return; + } try { OutputStream outstream = response.getOutputStream(); // setup output -- if mime type is set use that otherwise