tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kane, David" <David_K...@sra.com>
Subject RE: How to declare Output as Image?
Date Fri, 07 Sep 2001 15:49:59 GMT
Andrej,

I think you need to use Response.setContentType...

http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRespon
se.html#setContentType(java.lang.String)

Dave

-----Original Message-----
From: Andrej Rosenheinrich
To: tomcat-user@jakarta.apache.org
Sent: 9/7/01 10:39 AM
Subject: How to declare Output as Image?

Hello,

i have a servlet, getting an BufferedImage, that shall be displayed in 
my webpage. for doing this I use the following code:

        ServletOutputStream sos = response.getOutputStream();
        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
        encoder.encode(image);

(image is the Buffered Image)
Well, the servlet does something, the title-line even claims that there 
is a graphic of  a certain size (the right one, btw ;-)), but in the 
page is only the url of the servlet :-(
I guess, I somehow have to tell the servlet/outputstream??? that the 
upcoming data is an image. right? how can i do this in a servlet? any
hints?

TIA
Andrej

Mime
View raw message