You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pl...@apache.org on 2006/08/25 23:53:06 UTC
svn commit: r436971 - in /struts/struts2/trunk/core/src:
main/java/org/apache/struts2/ main/java/org/apache/struts2/components/
main/java/org/apache/struts2/dispatcher/mapper/
test/java/org/apache/struts2/dispatcher/mapper/
test/java/org/apache/struts2...
Author: plightbo
Date: Fri Aug 25 14:53:05 2006
New Revision: 436971
URL: http://svn.apache.org/viewvc?rev=436971&view=rev
Log:
nuking the compatibility mode stuff that disabled the ! and method: support for the time being. we'll come up with a more secure option (probably annotation) soon.
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java Fri Aug 25 14:53:05 2006
@@ -121,7 +121,4 @@
/** If static content served by the Struts filter should set browser caching header properties or not */
public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache";
-
- /** Whether Struts is in WebWork 2.2 compatibility mode or not */
- public static final String STRUTS_COMPATIBILITY_MODE_WEBWORK = "struts.compatibilityMode.WebWork";
}
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java Fri Aug 25 14:53:05 2006
@@ -83,17 +83,6 @@
protected boolean ignoreContextParams;
/**
- * Indicate whether WebWork compatibility mode is set.
- */
- protected static boolean compatibilityMode = false;
-
- static {
- if (org.apache.struts2.config.Settings.isSet(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK)) {
- compatibilityMode = "true".equals(org.apache.struts2.config.Settings.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK));
- }
- }
-
- /**
* Construct object instance, setting runtime parameters.
*
* @param stack Our OgnlValueStack
@@ -188,13 +177,11 @@
String actionName = actualName;
String methodName = null;
- if (compatibilityMode) {
- // handle "name!method" convention.
- int exclamation = actualName.lastIndexOf("!");
- if (exclamation != -1) {
- actionName = actualName.substring(0, exclamation);
- methodName = actualName.substring(exclamation + 1);
- }
+ // handle "name!method" convention.
+ int exclamation = actualName.lastIndexOf("!");
+ if (exclamation != -1) {
+ actionName = actualName.substring(0, exclamation);
+ methodName = actualName.substring(exclamation + 1);
}
String namespace;
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java Fri Aug 25 14:53:05 2006
@@ -101,13 +101,6 @@
protected String portletMode;
protected String windowState;
protected String acceptcharset;
- protected static boolean compatibilityMode = false;
-
- static {
- if (org.apache.struts2.config.Settings.isSet(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK)) {
- compatibilityMode = "true".equals(org.apache.struts2.config.Settings.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK));
- }
- }
public Form(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
@@ -230,11 +223,9 @@
}
String actionMethod = "";
- if (compatibilityMode && action.indexOf("!") != -1) {
- int endIdx = action.lastIndexOf("!");
- actionMethod = action.substring(endIdx + 1, action.length());
- action = action.substring(0, endIdx);
- }
+ int endIdx = action.lastIndexOf("!");
+ actionMethod = action.substring(endIdx + 1, action.length());
+ action = action.substring(0, endIdx);
Configuration config = Dispatcher.getInstance().getConfigurationManager().getConfiguration();
final ActionConfig actionConfig = config.getRuntimeConfiguration().getActionConfig(namespace, action);
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java Fri Aug 25 14:53:05 2006
@@ -149,21 +149,15 @@
static final String REDIRECT_ACTION_PREFIX = "redirect-action:";
private PrefixTrie prefixTrie = null;
- private boolean compatibilityMode = false;
public DefaultActionMapper() {
- if (org.apache.struts2.config.Settings.isSet(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK)) {
- compatibilityMode = "true".equals(org.apache.struts2.config.Settings.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK));
- }
prefixTrie = new PrefixTrie() {
{
- if (compatibilityMode) {
- put(METHOD_PREFIX, new ParameterAction() {
- public void execute(String key, ActionMapping mapping) {
- mapping.setMethod(key.substring(METHOD_PREFIX.length()));
- }
- });
- }
-
+ put(METHOD_PREFIX, new ParameterAction() {
+ public void execute(String key, ActionMapping mapping) {
+ mapping.setMethod(key.substring(METHOD_PREFIX.length()));
+ }
+ });
+
put(ACTION_PREFIX, new ParameterAction() {
public void execute(String key, ActionMapping mapping) {
String name = key.substring(ACTION_PREFIX.length());
@@ -217,15 +211,14 @@
return null;
}
- if (compatibilityMode) {
- // handle "name!method" convention.
- String name = mapping.getName();
- int exclamation = name.lastIndexOf("!");
- if (exclamation != -1) {
- mapping.setName(name.substring(0, exclamation));
- mapping.setMethod(name.substring(exclamation + 1));
- }
+ // handle "name!method" convention.
+ String name = mapping.getName();
+ int exclamation = name.lastIndexOf("!");
+ if (exclamation != -1) {
+ mapping.setName(name.substring(0, exclamation));
+ mapping.setMethod(name.substring(exclamation + 1));
}
+
return mapping;
}
@@ -372,18 +365,13 @@
}
uri.append(name);
- if (compatibilityMode) {
- if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
- uri.append("!").append(mapping.getMethod());
- }
+ if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
+ uri.append("!").append(mapping.getMethod());
}
String extension = getDefaultExtension();
if ( extension != null) {
-
- // When in compatibility mode, we don't add an extension if it exists already
- // otherwise, we always add it
- if (!compatibilityMode || (compatibilityMode && uri.indexOf( '.' + extension) == -1 )) {
+ if (uri.indexOf( '.' + extension) == -1 ) {
uri.append(".").append(extension);
if ( params.length() > 0) {
uri.append(params);
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java Fri Aug 25 14:53:05 2006
@@ -378,20 +378,13 @@
}
public void testGetUriFromActionMapper12() throws Exception {
- String old = org.apache.struts2.config.Settings.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK);
- org.apache.struts2.config.Settings.set(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK, "true");
- try {
- DefaultActionMapper mapper = new DefaultActionMapper();
- ActionMapping actionMapping = new ActionMapping();
- actionMapping.setName("myActionName.action");
- actionMapping.setNamespace("/");
- String uri = mapper.getUriFromActionMapping(actionMapping);
+ DefaultActionMapper mapper = new DefaultActionMapper();
+ ActionMapping actionMapping = new ActionMapping();
+ actionMapping.setName("myActionName.action");
+ actionMapping.setNamespace("/");
+ String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myActionName.action", uri);
- }
- finally {
- org.apache.struts2.config.Settings.set(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK, old);
- }
+ assertEquals("/myActionName.action", uri);
}
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java?rev=436971&r1=436970&r2=436971&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java Fri Aug 25 14:53:05 2006
@@ -207,7 +207,6 @@
// TODO - !input form fails in Maven, but passes in IDEA. The settings seem to be ignored under Maven.
public void FIXME_testActionMethodWithExecuteResult() throws Exception {
- org.apache.struts2.config.Settings.set(StrutsConstants.STRUTS_COMPATIBILITY_MODE_WEBWORK, "true");
ActionTag tag = new ActionTag();
tag.setPageContext(pageContext);
tag.setNamespace("");