WW-1491 Add setting to govern whether to force the initial letter of an action to lowercase.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@478316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ted Nathan Husted
2006-11-22 20:45:48 +00:00
parent 116070b28e
commit 0aa2376e62
@@ -88,6 +88,19 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider {
*/
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.
*/
@@ -150,6 +163,9 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider {
defaultPagePrefix = Settings.get(DEFAULT_PAGE_PREFIX);
}
if (Settings.isSet(FORCE_LOWER_CASE)) {
forceLowerCase = Settings.get(FORCE_LOWER_CASE).equalsIgnoreCase("true");
}
}
/**
@@ -293,8 +309,8 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider {
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));