|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Oct 2007
Messaggi: 34
|
[Java-Servlet] File Download
Salve ragazzi vorrei un informazione e' possibile fare una cosa del genere:
Supponendo che io voglia restituire al client un file (non di testo) Codice:
out= response.getOutputStream();
response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachment; f ilename=" + file.getName());
response.setContentLength((int) file.length());
buf = new BufferedInputStream(new FileInputStream(file));
while ((readBytes = buf.read()) != -1) {
out.write(readBytes);
}
out.close();
buf.close();
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 13:05.


















