<%@ page import="java.io.*"%><%
// This is simple code for downloading a file from HTTP server 
// Usage: http://server-name:port/getreport.jsp?filepath=[full_file_path]
// Author: Lion Van
// Email: support@lv2000.com
  String sFilePath=request.getParameter("filepath");
  
  BufferedOutputStream bos = null;
  BufferedInputStream bis = null;
  try{
	  bos = new BufferedOutputStream(response.getOutputStream());
	  bis = new BufferedInputStream(
		  new FileInputStream(sFilePath) );
	  byte buff[]=new byte[2042];
	  int bytesread;
	  while ((bytesread=bis.read(buff,0,buff.length))!=-1)
		  bos.write(buff,0,bytesread);
  } catch(final IOException e) { 
	  System.out.println ( "IOException." );
	  throw e;
  }catch(Exception e){System.out.println(e);}
  finally{
	  if (bis!=null)
		 bis.close();
  }
   
%>