Re: image download

2008-09-27 Thread Johnny Kewl
- Original Message - From: "Dave" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Saturday, September 27, 2008 3:38 AM Subject: Re: image download InputStream is = new FileInputStream("/apphome/pictures/image.jpg"); OutputStream os = respon

Re: image download

2008-09-26 Thread T . K . Thiyagarajan
My code given below works fine. U can try if u want public void sendImageFile(HttpServletResponse response) { FileInputStream in=null; File f = null; try { f = new File("webapps/Plasma/graphs", "image.gif"); in = new FileInputStream(f

Re: image download

2008-09-26 Thread Konstantin Kolinko
2008/9/27 Dave <[EMAIL PROTECTED]>: > For http://domain.com/servlet/pictures/image.jpg"/> > > in servlet get method, > > InputStream is = new FileInputStream("/apphome/pictures/image.jpg"); > OutputStream os = response.getOutputStream(); > > byte[] buffer = new byte[256*1024]; //256k > while (true

Re: image download

2008-09-26 Thread Dave
InputStream is = new FileInputStream("/apphome/pictures/image.jpg"); OutputStream os = response.getOutputStream();   byte[] buffer = new byte[256*1024];  //256k while (true) { int n = is.read(buffer);      if (n < 0)   break;   os.write(buffer, 0, n); }   is.close(); os.close();