diff options
author | Thomas <> | 2023-09-13 09:31:51 +0200 |
---|---|---|
committer | Thomas <> | 2023-09-13 09:31:51 +0200 |
commit | 5fc01be0bac1394e9a48f1631679485ab5a2fdc4 (patch) | |
tree | 9f479a9203a49dbbdf605ce4d079c1b047bb0704 /pdf-as-web/src/main/java/at/gv | |
parent | 4b8ac0fd970aacf8fe0638fa24f6aa626b89fa56 (diff) | |
download | pdf-as-4-5fc01be0bac1394e9a48f1631679485ab5a2fdc4.tar.gz pdf-as-4-5fc01be0bac1394e9a48f1631679485ab5a2fdc4.tar.bz2 pdf-as-4-5fc01be0bac1394e9a48f1631679485ab5a2fdc4.zip |
feat(core): add custom HTTP header to provide filename
Reason: 'Content-Disposition' header only supports ASCI characters
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java index 031eeac2..96d02f16 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java @@ -26,6 +26,8 @@ package at.gv.egiz.pdfas.web.servlets; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.Iterator; import java.util.List; import java.util.zip.Deflater; @@ -236,6 +238,11 @@ public class PDFData extends HttpServlet { } response.setHeader("Content-Disposition", "inline;filename=\"" + PdfAsHelper.getPDFFileName(request) + "\""); + + response.setHeader("X-FILENAME-BASE64URL", + Base64.getUrlEncoder().encodeToString( + PdfAsHelper.getPDFFileName(request).getBytes(StandardCharsets.UTF_8))); + final String pdfCert = signedFile.getSignerCertificate(); if (pdfCert != null) { response.setHeader("Signer-Certificate", pdfCert); |