src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java

changeset 168
1c3694ae224c
parent 167
3f30adba1c63
--- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Mon Dec 21 18:29:34 2020 +0100
+++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat Dec 26 20:19:09 2020 +0100
@@ -275,7 +275,7 @@
     private <T> Optional<T> parseParameter(String paramValue, Class<T> clazz) {
         if (paramValue == null) return Optional.empty();
         if (clazz.equals(Boolean.class)) {
-            if (paramValue.toLowerCase().equals("false") || paramValue.equals("0")) {
+            if (paramValue.equalsIgnoreCase("false") || paramValue.equals("0")) {
                 return Optional.of((T) Boolean.FALSE);
             } else {
                 return Optional.of((T) Boolean.TRUE);
@@ -349,6 +349,13 @@
         }
     }
 
+    protected void setAttributeFromParameter(HttpServletRequest req, String name) {
+        final var parm = req.getParameter(name);
+        if (parm != null) {
+            req.setAttribute(name, parm);
+        }
+    }
+
     private String sanitizeRequestPath(HttpServletRequest req) {
         return Optional.ofNullable(req.getPathInfo()).orElse("/");
     }

mercurial