[jboss-user] [JBoss Portal] - file download
brain101
do-not-reply at jboss.com
Tue Aug 22 08:57:13 EDT 2006
is it possible to realize a file download via a portlet?
via servlet the code would look something like this:
response.setContentType ("text/plain");
response.setHeader ("Content-Disposition", "attachment; filename=\"testfile.txt\"");
ServletOutputStream op = response.getOutputStream ();
InputStream in = new FileInputStream(p_dir+request.getParameter("p_file"));
byte[] b = new byte[4 * 1024];
int len = 0;
while ((len = in.read(b)) != -1) {
op.write(b, 0, len);
}
in.close();
op.flush();
op.close();
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966689#3966689
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966689
More information about the jboss-user
mailing list