Aren't we going to keep the settings defined in StrutsConstants? Also,
you need to define a setter with an @Inject annotation for it to be
populated. Don't use the Settings object, as it shouldn't be used
anymore. In fact, it should even be viewable from that package as I
made it package private....
Don
[EMAIL PROTECTED] wrote:
Author: husted
Date: Wed Nov 22 12:45:48 2006
New Revision: 478316
URL: http://svn.apache.org/viewvc?view=rev&rev=478316
Log:
WW-1491 Add setting to govern whether to force the initial letter of an action
to lowercase.
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java?view=diff&rev=478316&r1=478315&r2=478316
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
Wed Nov 22 12:45:48 2006
@@ -89,6 +89,19 @@
private String defaultParentPackage = "struts-default";
/**
+ * The default page prefix (or "path").
+ * Some applications may place pages under "/WEB-INF" as an extreme
security precaution.
+ */
+ private static final String FORCE_LOWER_CASE =
"struts.configuration.classpath.forceLowerCase";
+
+ /**
+ * Whether to use a lowercase letter as the initial letter of an action.
+ * If false, actions will retain the initial uppercase letter from the
Action class.
+ * (<code>view.action</code> (true) versus <code>View.action</code>
(false)).
+ */
+ private boolean forceLowerCase = true;
+
+ /**
* Default suffix that can be used to indicate POJO "Action" classes.
*/
private static final String ACTION = "Action";
@@ -150,6 +163,9 @@
defaultPagePrefix = Settings.get(DEFAULT_PAGE_PREFIX);
}
+ if (Settings.isSet(FORCE_LOWER_CASE)) {
+ forceLowerCase =
Settings.get(FORCE_LOWER_CASE).equalsIgnoreCase("true");
+ }
}
/**
@@ -293,8 +309,8 @@
actionName = actionName.substring(0, actionName.length() -
ACTION.length());
}
- // Force initial letter of action to lowercase
- if (actionName.length() > 1) {
+ // Force initial letter of action to lowercase, if desired
+ if ((forceLowerCase) && (actionName.length() > 1)) {
int lowerPos = actionName.lastIndexOf('/') + 1;
StringBuilder sb = new StringBuilder();
sb.append(actionName.substring(0, lowerPos));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]