** サーブレットでファイルダウンロード [#g4be30db]
#setlinebreak(on);

《関連》
#html(<div style="border:1px solid #000000;padding:4px;margin:0px 0px 20px 0px;">)
[[サーバ側で作成したPDFの表示とクライアントPCへの保存]]
#html(</div>)

#mycode{{
// ファイルのダウンロード
response.setContentType("application/octet-stream; charset=\""+DOWNLOAD_CHARSET+"\"");
response.setHeader("Content-Disposition", "attachment; filename=\""+ fileName + "\"");
// attachment でなく inline とかするとブラウザウィンドウ内に表示(ブラウザの仕様にもよるかもしれない)
 
out = response.getOutputStream(); 
in = new FileInputStream(zipFilePath);
int c;
while ((c = in.read()) != -1) { 
 	out.write(c);
}
 
// ファイル名のエンコード
//fileName = URLEncoder.encode(fileName, FILE_NAME_ENCODING);
fileName = new String(fileName.getBytes("Shift_JIS"), "ISO-8859-1");
}}

《関連》
#html(<div style="border:1px solid #000000;padding:4px;margin:0px 0px 20px 0px;">)
[[サーバ側で作成したPDFの表示とクライアントPCへの保存]]
#html(</div>)


トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS