質問するログイン新規登録

質問編集履歴

2

自己解決記入欄に移管する

2021/12/16 00:13

投稿

ImPathy
ImPathy

スコア29

title CHANGED
File without changes
body CHANGED
@@ -63,22 +63,4 @@
63
63
  .build();
64
64
  }
65
65
 
66
- ```
67
-
68
- 2021.12.16
69
- 以下のやり方でファイルを書き込まずにダウンロードできました。
70
- ```Java
71
- bos = new ByteArrayOutputStream();
72
- document.save(bos);
73
-
74
- } catch (IOException e) {
75
- e.printStackTrace();
76
- }
77
-
78
- // レスポンス情報
79
- return Response.ok((Object)bos.toByteArray()).header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
80
- .header("Content-Disposition", "attachment;filename=" + encodingStringByUTF8(fileName+".pdf"))
81
- .header("Content-Lentgh", file.length())
82
- .build();
83
- }
84
66
  ```

1

修正後コードを記載

2021/12/16 00:13

投稿

ImPathy
ImPathy

スコア29

title CHANGED
File without changes
body CHANGED
@@ -63,4 +63,22 @@
63
63
  .build();
64
64
  }
65
65
 
66
+ ```
67
+
68
+ 2021.12.16
69
+ 以下のやり方でファイルを書き込まずにダウンロードできました。
70
+ ```Java
71
+ bos = new ByteArrayOutputStream();
72
+ document.save(bos);
73
+
74
+ } catch (IOException e) {
75
+ e.printStackTrace();
76
+ }
77
+
78
+ // レスポンス情報
79
+ return Response.ok((Object)bos.toByteArray()).header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
80
+ .header("Content-Disposition", "attachment;filename=" + encodingStringByUTF8(fileName+".pdf"))
81
+ .header("Content-Lentgh", file.length())
82
+ .build();
83
+ }
66
84
  ```