does that mean that we can't use out.print in our jsp 1.1?


----- Original Message -----
From: Craig R. McClanahan <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 23, 2000 1:33 AM
Subject: Re: serving an image from a JSP file with Resin 1.2.b2


> Matthew Hixson wrote:
>
> > I need to be able to serve up an image to a customer based upon the
branding of
> > their site.  For example, they should get their logo when they ask for
> > logo.gif.  I'm doing this by making the src attribute of the img tag
point them
> > to "imageServer.jsp?name=logo.gif".  This way I can serve up their image
> > without them being able to find out who our other customers are.
> >   In the code below I've tried to remove all newlines because they were
getting
> > inserted into the stream that goes back to the browser and causing the
> > resulting file to appear as something other than a gif image.  Now the
problem
> > is that the data which is sent to the browser is always exactly one byte
larger
> > than the actual file as it sits on the hard drive.  If I use 'lynx -dump
> > http://url/to/imageServer.jsp?name=logo.gif > /tmp/logo.gif' the file
will be
> > one byte larger than it is on the web server.  This extra byte must be
getting
> > appended to the file because the browser will still display the gif
correctly.
> > I think that the JSP server (Resin 1.2.b2) is appending one carriage
return to
> > the end of the file.
> >   I've considered leaving it alone as it appears to be working, but
that's just
> > not my style.
> >   I realize I could write this as a servlet, but I would prefer to use a
JSP.
> > If anyone has any ideas on how I can tell Resin to stop sending that
extra byte
> > I'd really like to hear it.
> >   Thanks,
> >     -M@
> >
>
> See the JSP 1.1 spec, section 2.5.4, page 41:
>
>     "JSP page authors are prohibited from writing directly to
>     either the PrintWriter or OutputStream associated with
>     the ServletResponse".
>
> If you want to create dynamic images like this, you need to use a servlet
instead
> of a JSP page.
>
> Craig McClanahan
>
> ====================
> See you at ApacheCon Europe <http://www.apachecon.com>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to