struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4601 Hides webconsole when not in devMode
Date Fri, 08 Jul 2016 04:40:11 GMT
Repository: struts
Updated Branches:
  refs/heads/master 78f9bac5e -> a31766821


WW-4601 Hides webconsole when not in devMode


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/a3176682
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/a3176682
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/a3176682

Branch: refs/heads/master
Commit: a317668213062d071de68e6008197d1ca6ed3dbc
Parents: 78f9bac
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Jul 8 06:40:01 2016 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Jul 8 06:40:01 2016 +0200

----------------------------------------------------------------------
 .../dispatcher/DefaultStaticContentLoader.java    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/a3176682/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
index 9fe3858..1053368 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
@@ -23,6 +23,7 @@ package org.apache.struts2.dispatcher;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
@@ -96,6 +97,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
      */
     protected String encoding;
 
+    protected boolean devMode;
 
     /**
      * Modify state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.
@@ -129,6 +131,11 @@ public class DefaultStaticContentLoader implements StaticContentLoader
{
         this.encoding = encoding;
     }
 
+    @Inject(StrutsConstants.STRUTS_DEVMODE)
+    public void setDevMode(String devMode) {
+        this.devMode = Boolean.parseBoolean(devMode);
+    }
+
     /*
      * (non-Javadoc)
      *
@@ -144,7 +151,16 @@ public class DefaultStaticContentLoader implements StaticContentLoader
{
     }
 
     protected String getAdditionalPackages() {
-        return "org.apache.struts2.static template org.apache.struts2.interceptor.debugging
static";
+        List<String> packages = new LinkedList<>();
+        packages.add("org.apache.struts2.static");
+        packages.add("template");
+        packages.add("static");
+
+        if (devMode) {
+            packages.add("org.apache.struts2.interceptor.debugging");
+        }
+
+        return StringUtils.join(packages.iterator(), ' ');
     }
 
     /**


Mime
View raw message