0
Bytea型に格納したPDFファイルを取り出し表示したい
ファイルの出力についての質問です。
Postgresql8.1のBytea型に格納したPDFファイルを取り出し、出力するという処理を行いたいのですが
以下のコードでは真っ白な画面が返るだけで、PDFファイルが表示されません。
試に、ResponseUtil.downloadを利用してダウンロードダイアログを出力する方法では、うまく表示されましたが
ダウンロードダイアログなしに直接PDFを開きたいと考えています。
PrintWriterを使うなど、試行錯誤していますが手がない状態です。アドバイスをお願い致します。
-----
public HttpServletResponse response;
public String execute() throws Exception {
// ファイル名
String filename = "output.pdf";
response.setHeader("Pragma", "");
response.addHeader("Cache-Control", "");
response.addHeader("Content-Disposition", "inline" + "; filename=" + filename);
response.setContentType("application/pd"f);
response.setContentLength(new Long(filename.length()).intValue());
response.getOutputStream().write(entity.pdfFile);
OutputStream out = response.getOutputStream();
out.flush();
return null;
}