Problem solved: Many thanks for the replies...
Chris ... FileInputStream in = new FileInputStream(filename); bytes = IOUtils.toByteArray(in); in.close(); response.setHeader("Content-Type", "image/jpeg"); response.setDateHeader("Expires", System.currentTimeMillis( ) + 24*60*60*1000); response.setHeader("Content-Disposition", "attachment;filename=" + upliftNumber + "_" + imgNum + ".jpg"); OutputStream out; if (MyUtil.acceptsGZIP(request)) { response.setHeader("Content-Encoding", "gzip"); out = new GZIPOutputStream(response.getOutputStream( )); } else { out = response.getOutputStream( ); } IOUtils.write(bytes, out); out.flush(); out.close(); snowch wrote: > > Hi Forum, > > My application needs to serve images to users but each image request is > checked to ensure the user has permission to view the image. To do this, > I have created a custom bsh servlet to serve the images for a ftl page > (which are included using tags). There can be 20 to 30 images per page. > The images are around 40Kb. The page is currently taking 20+ seconds to > load the images. I have noticed in the log that there be a few second > delay between the ImageServlet finishing and the next request being > handled by the ContextFilter (see below). > > Does anyone on this forum have any idea what can be causing the delay? > > Many thanks in advance, > > Chris > > 2009-05-11 20:37:56,097 (TP-Processor3) [ > ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, > Servlet Finished- total:0.188,since last([ImageServlet] Se...):0.125]] > 2009-05-11 20:37:56,112 (TP-Processor2) [ > TransactionUtil.java:187:DEBUG] [TransactionUtil.commit] transaction > committed > 2009-05-11 20:37:56,112 (TP-Processor2) [ > ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, > Servlet Finished- total:0.203,since last([ImageServlet] Se...):0.14]] > 2009-05-11 20:38:01,597 (TP-Processor2) [ ContextFilter.java:182:INFO > ] [Request]: /xxx/control/ImageServlet > 2009-05-11 20:38:01,612 (TP-Processor3) [ ContextFilter.java:182:INFO > ] [Request]: /xxx/control/ImageServlet > > -- View this message in context: http://www.nabble.com/Performance-issues-tp23490557p23552601.html Sent from the OFBiz - User mailing list archive at Nabble.com.