You need to do:
out.flush();
out.close();
This will probably solve the problem.
Nick.
-----Original Message-----
From: Vikram Kumar [mailto:[EMAIL PROTECTED]]
Sent: 15 July 2000 06:41
To: [EMAIL PROTECTED]
Subject: Problem with displaying images through servlet...
Dear Friends,
HI! i have made a small servlet which sends back the imagge stream back
to the broswer. The problem is that the complet image is not being sent
back.. i.e only 20-30% image is being displayed and then the browser
shows document done. I am using Apache Web Server with JServ.my code is
as follows
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.awt.*;
import java.awt.image.*;
import java.net.*;
public class ImageServlet extends HttpServlet {
//Frame frame=new Frame();
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
try{
URL url=new URL("http://192.168.1.182/RoseBud.jpg");
InputStream fin=url.openStream();
res.setContentType("image/jpeg");
ServletOutputStream out=res.getOutputStream();
byte c;
int i=0;
do
{
i=fin.read();
c=(byte)i;
out.write(c);
}
while(i!=-1);
fin.close();
}
catch(Exception e)
{
log("exception is"+e);
}
}
}
Thanking You In Anticapation
--
Vikram Kumar
Software Services International,
Ph : 91-6397534
ext: 213
"To the world, you may be one person
But to one person, you may be the world"
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
***************************************************************
The contents of this Email and any files transmitted with it
are confidential and intended solely for the use of the
individual or entity to whom it is addressed. The views stated
herein do not necessarily represent the view of the company.
If you are not the intended recipient of this Email you may not
copy, forward, disclose or otherwise use it or any part of it
in any form whatsoever. If you have received this mail in
error please Email the sender.
***************************************************************
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html