ServletUtil test

This commit is contained in:
duandazhi
2021-03-25 13:18:05 +08:00
parent 0d0f70bf15
commit ce82b2ae35

View File

@@ -22,7 +22,7 @@ public class ServletUtilTest {
// 这里没法直接测试,直接写到这里,方便调用; // 这里没法直接测试,直接写到这里,方便调用;
if (response != null) { if (response != null) {
String fileName = "签名文件.pdf"; String fileName = "签名文件.pdf";
String contentType = "application/pdf";// application/octet-stream、 String contentType = "application/pdf";// application/octet-stream、image/jpeg、image/gif
response.setCharacterEncoding(StandardCharsets.UTF_8.name()); // 必须设置否则乱码; 但是 safari乱码 response.setCharacterEncoding(StandardCharsets.UTF_8.name()); // 必须设置否则乱码; 但是 safari乱码
ServletUtil.write(response, new ByteArrayInputStream(bytes), contentType, fileName); ServletUtil.write(response, new ByteArrayInputStream(bytes), contentType, fileName);
} }