From 759f2277f9b6cf339d8fcc5631ea547855ab9e56 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Fri, 25 Jun 2021 13:10:41 +0200 Subject: seems to work on most systems .. --- pdf-as-web/src/main/assembly/tomcat/setVariables.bat | 4 ++-- .../egiz/pdfas/web/helper/PdfAsParameterExtractor.java | 14 ++++++++++++-- pdf-as-web/src/main/webapp/WEB-INF/web.xml | 17 ++++++++++++++++- pdf-as-web/src/main/webapp/index.jsp | 11 +++++++---- 4 files changed, 37 insertions(+), 9 deletions(-) (limited to 'pdf-as-web/src') diff --git a/pdf-as-web/src/main/assembly/tomcat/setVariables.bat b/pdf-as-web/src/main/assembly/tomcat/setVariables.bat index 606f84e1..57bd2f9a 100644 --- a/pdf-as-web/src/main/assembly/tomcat/setVariables.bat +++ b/pdf-as-web/src/main/assembly/tomcat/setVariables.bat @@ -59,10 +59,10 @@ rem Maximum PermGenSize in M set JVM_MAXPERMSIZE=256 rem COMMAND LINE OPTIONS -set JAVA_OPTS=-server -Xss%JVM_XSS%k -Xms%JVM_XMS%m -Xmx%JVM_XMX%m -XX:MaxPermSize=%JVM_MAXPERMSIZE%m +set JAVA_OPTS=-server -Xss%JVM_XSS%k -Xms%JVM_XMS%m -Xmx%JVM_XMX%m -XX:MaxPermSize=%JVM_MAXPERMSIZE%m -Dfile.encoding=UTF8 set CATALINA_OPTS=%PDFAS_WORK_DIR_PARAM% rem SERVICE OPTIONS -set SERVICE_OPTS=%PDFAS_WORK_DIR_PARAM%;-XX:MaxPermSize=%JVM_MAXPERMSIZE%m +set SERVICE_OPTS=%PDFAS_WORK_DIR_PARAM%;-XX:MaxPermSize=%JVM_MAXPERMSIZE%m -Dfile.encoding=UTF8 :END diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index 00ca9446..31fbf46d 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -23,6 +23,7 @@ ******************************************************************************/ package at.gv.egiz.pdfas.web.helper; +import java.nio.charset.Charset; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -31,6 +32,8 @@ import javax.servlet.http.HttpServletRequest; import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PdfAsParameterExtractor { @@ -76,6 +79,9 @@ public class PdfAsParameterExtractor { public static final String PARAM_QRCODE_CONTENT = "qrcontent"; public static final String PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER = "sbp:"; + private static final Logger logger = LoggerFactory + .getLogger(PdfAsParameterExtractor.class); + public static String getConnector(HttpServletRequest request) { String connector = (String)request.getAttribute(PARAM_CONNECTOR); if(connector != null) { @@ -86,15 +92,19 @@ public class PdfAsParameterExtractor { public static Map getDynamicSignatureBlockParameters(HttpServletRequest request) throws Exception { HashMap signatureBlockParametersMap = new HashMap(); - + logger.debug("Default charset:"+ Charset.defaultCharset()); + logger.debug("Request charset:"+ request.getCharacterEncoding()); + Enumeration parameterNames = request.getAttributeNames(); while(parameterNames.hasMoreElements()) { String parameterName = parameterNames.nextElement(); if (parameterName.startsWith(PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER)) { String key = parameterName.substring(PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER.length()); String value = (String) request.getAttribute(parameterName); - if(value != null && !value.isEmpty()) + if(value != null && !value.isEmpty()){ signatureBlockParametersMap.put(key, value); + logger.debug("Setting key "+ key +" to "+ value ); + } } } return signatureBlockParametersMap; diff --git a/pdf-as-web/src/main/webapp/WEB-INF/web.xml b/pdf-as-web/src/main/webapp/WEB-INF/web.xml index 9b69c983..7920ad91 100644 --- a/pdf-as-web/src/main/webapp/WEB-INF/web.xml +++ b/pdf-as-web/src/main/webapp/WEB-INF/web.xml @@ -31,7 +31,22 @@ * - + + + + setCharacterEncodingFilter + org.apache.catalina.filters.SetCharacterEncodingFilter + + encoding + UTF-8 + + + + + + setCharacterEncodingFilter + /* +