Commit 2cdd79c5 authored by Julien Lerouge's avatar Julien Lerouge

Update

parent ab802d4b
......@@ -26,6 +26,7 @@ package digilib.servlet;
* Author: Robert Casties (robcast@berlios.de)
*/
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
......@@ -321,8 +322,7 @@ public class ServletOps {
logger.debug("sending to response. committed=" + response.isCommitted());
// TODO: should we erase or replace old last-modified header?
try {
OutputStream outstream = response.getOutputStream();
// setup output -- if mime type is set use that otherwise
// setup output -- if mime type is set use that otherwise
// if source is JPG then dest will be JPG else it's PNG
if (mimeType == null) {
mimeType = img.getMimetype();
......@@ -338,9 +338,18 @@ public class ServletOps {
} else {
mimeType = "image/png";
}
// write the image
response.setContentType(mimeType);
// write the image to a temporary output stream
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
img.writeImage(mimeType, outstream);
// sets the content length
response.setContentLength(outstream.size());
// copy the image to the real output stream
outstream.writeTo(response.getOutputStream());
} catch (IOException e) {
throw new ServletException("Error sending image:", e);
}
......
......@@ -16,7 +16,7 @@
Directories with low-resolution images are LAST!!! in list.
Use OS-specific path separators (":" for Unix, ";" for Windows) -->
<!--<parameter name="basedir-list" value="/home/lerouju8/web/images" />-->
<parameter name="basedir-list" value="/home/pivaj/images" />
<parameter name="basedir-list" value="/home/entitees/proj-litis/pivaj/images" />
<!-- Java class to use for image operations -->
<!--<parameter name="docuimage-class" value="digilib.image.JAIImageLoaderDocuImage" />-->
......@@ -35,10 +35,10 @@
<parameter name="max-image-size" value="0" />
<!-- number of working threads -->
<parameter name="worker-threads" value="2" />
<parameter name="worker-threads" value="16" />
<!-- number of waiting requests in queue -->
<parameter name="max-waiting-threads" value="20" />
<parameter name="max-waiting-threads" value="128" />
<!-- timeout for asynchronous servlet worker (ms) -->
<parameter name="worker-timeout" value="60000" />
......
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