changeset 830:f4d3543b6a62 stream

fixed mo=jpeg or png being ignored.
author robcast
date Fri, 25 Feb 2011 11:51:29 +0100
parents a630d0303cce
children 30037e93ec2a
files servlet/src/digilib/servlet/AsyncServletWorker.java servlet/src/digilib/servlet/Scaler.java servlet/src/digilib/servlet/ScalerNoAsync.java servlet/src/digilib/servlet/ScalerNoThread.java
diffstat 4 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/AsyncServletWorker.java	Fri Feb 25 11:34:49 2011 +0100
+++ b/servlet/src/digilib/servlet/AsyncServletWorker.java	Fri Feb 25 11:51:29 2011 +0100
@@ -60,8 +60,15 @@
         try {
             // render the image
             DocuImage img = imageWorker.call();
+            // forced destination image type
+            String mt = null;
+            if (jobinfo.hasOption("jpg")) {
+            	mt = "image/jpeg";
+            } else if (jobinfo.hasOption("png")) {
+            	mt = "image/png";
+            }
             // send image
-            ServletOps.sendImage(img, null, response, logger);
+            ServletOps.sendImage(img, mt, response, logger);
             logger.debug("Job done in: "
                     + (System.currentTimeMillis() - startTime) + "ms");
         } catch (ImageOpException e) {
--- a/servlet/src/digilib/servlet/Scaler.java	Fri Feb 25 11:34:49 2011 +0100
+++ b/servlet/src/digilib/servlet/Scaler.java	Fri Feb 25 11:51:29 2011 +0100
@@ -31,7 +31,7 @@
     private static final long serialVersionUID = 5289386646192471549L;
 
     /** digilib servlet version (for all components) */
-    public static final String version = "1.9.1a11";
+    public static final String version = "1.9.1a12";
 
     /** servlet error codes */
     public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};
--- a/servlet/src/digilib/servlet/ScalerNoAsync.java	Fri Feb 25 11:34:49 2011 +0100
+++ b/servlet/src/digilib/servlet/ScalerNoAsync.java	Fri Feb 25 11:51:29 2011 +0100
@@ -256,8 +256,15 @@
             Future<DocuImage> jobResult = imageJobCenter.submit(job);
             // wait for result
             DocuImage img = jobResult.get();
+            // forced destination image type
+            String mt = null;
+            if (jobTicket.hasOption("jpg")) {
+            	mt = "image/jpeg";
+            } else if (jobTicket.hasOption("png")) {
+            	mt = "image/png";
+            }
             // send image
-            ServletOps.sendImage(img, null, response, logger);
+            ServletOps.sendImage(img, mt, response, logger);
             logger.debug("Job Processing Time: "
                     + (System.currentTimeMillis() - startTime) + "ms");
 
--- a/servlet/src/digilib/servlet/ScalerNoThread.java	Fri Feb 25 11:34:49 2011 +0100
+++ b/servlet/src/digilib/servlet/ScalerNoThread.java	Fri Feb 25 11:51:29 2011 +0100
@@ -238,8 +238,15 @@
             ImageWorker job = new ImageWorker(dlConfig, jobTicket);
             // get result immediately
             DocuImage img = job.call();
+            // forced destination image type
+            String mt = null;
+            if (jobTicket.hasOption("jpg")) {
+            	mt = "image/jpeg";
+            } else if (jobTicket.hasOption("png")) {
+            	mt = "image/png";
+            }
             // send image
-            ServletOps.sendImage(img, null, response, logger);
+            ServletOps.sendImage(img, mt, response, logger);
             logger.debug("Job Processing Time: "
                     + (System.currentTimeMillis() - startTime) + "ms");