Dashboard > Community Wiki > ... > Troubleshooting > Errors in image generating JSPs
Errors in image generating JSPs Log In View a printable version of the current page.

Added by GrĂ©gory Joseph , last edited by Boris Kraft on Jun 23, 2008  (view change)
Labels: 
(None)

Error in image generating JSPs

Problem

  • Content-type of images will not be correctly set.
  • At least with Mozilla 1.7: several additional seconds until page is fully loaded
  • Images will not be stored in the browser cache

Reason

There is (text)-output in the image generating JSP. Typically you find in the generated servlet class a line like

out.write("\n");

and before that a line like

response.setContentType("text/html");

The newline character will be written because the JSP directives are in separate lines

Solution

Join the lines with comments.

<%-- 
--%>

So, typically the head of such a JSP should look like

<%@ page contentType="image/jpg" %><%-- 
--%><%@ page import="com.obinary.cms.beans.File, 
com.obinary.cms.util.Resource, 
java.io.InputStream, 
java.awt.image.BufferedImage, 
java.awt.*, 
java.io.BufferedOutputStream, 
com.sun.image.codec.jpeg.JPEGImageEncoder, 
com.sun.image.codec.jpeg.JPEGCodec, 
com.sun.image.codec.jpeg.JPEGEncodeParam, 
javax.imageio.ImageIO, 
java.io.IOException, 
java.awt.image.PixelGrabber, 
com.sun.image.codec.jpeg.JPEGImageDecoder, 
com.obinary.cms.beans.MultipartForm, 
com.obinary.cms.core.HierarchyManager, 
com.obinary.cms.core.NodeData"%><%-- 
--%><% 
...

Files with that problem to fix in Magnolia installation package are

  • admintemplates/jsp/dialog/fileThumbnail.jsp
  • templates/jsp/samples/rightColumn/imageTemplate.jsp

In its previous incarnation on JspWiki, this page was last edited on Feb 9, 2007 10:12:03 AM by 212.163.159.14
Other known authors include :

  • RalfHirning
  • RalfHirning
  • RalfHirning
  • RalfHirning
  • RalfHirning
  • 61.145.233.118
Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators