How about this one?
FileUtils (Commons IO 2.5-SNAPSHOT API)
example
/src_directory_path/ is mount directory of remote server.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("application/octet-stream");
resp.setHeader("Content-Disposition", "filename="hoge.txt"");
File srcFile = new File("/src_directory_path/hoge.txt");
FileUtils.copyFile(srcFile, resp.getOutputStream());
}
Was this by any chance what you wanted to hear?
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
InputStream in = new URL( "http://remote.file.url" ).openStream();
IOUtils.copy(in, response.getOutputStream());
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…