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

Reply via email to