Author: mrdon
Date: Mon Jul 17 21:15:02 2006
New Revision: 422956
URL: http://svn.apache.org/viewvc?rev=422956&view=rev
Log:
Removed action!method syntax by default, however, it can be enabled
by specifying the "struts.compatibilityMode" property to true.
WW-1353
Modified:
struts/struts2/trunk/apps/showcase/quickstart.xml
struts/struts2/trunk/apps/showcase/src/main/resources/struts-person.xml
struts/struts2/trunk/apps/showcase/src/main/resources/struts-token.xml
struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DefautActionMapperTest.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/ui/FormTagTest.java
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-10.txt
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-9.txt
Modified: struts/struts2/trunk/apps/showcase/quickstart.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/quickstart.xml?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/quickstart.xml (original)
+++ struts/struts2/trunk/apps/showcase/quickstart.xml Mon Jul 17 21:15:02 2006
@@ -12,7 +12,7 @@
users who don't have a single directory in their project that
contains all the libraries they need.
-->
-
<ideaConfig>../../../xwork/xwork.iml,../../core/struts-core.iml,struts-showcase.iml</ideaConfig>
+
<ideaConfig>../../../../xwork/xwork.iml,../../core/struts2-core.iml,struts2-showcase.iml</ideaConfig>
<!-- The context in which to deploy the web application -->
<context>/showcase</context>
Modified:
struts/struts2/trunk/apps/showcase/src/main/resources/struts-person.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-person.xml?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-person.xml
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-person.xml Mon
Jul 17 21:15:02 2006
@@ -13,7 +13,7 @@
<result type="freemarker">listPeople.ftl</result>
</action>
- <action name="newPerson"
class="org.apache.struts2.showcase.person.CreatePerson">
+ <action name="newPerson!*"
class="org.apache.struts2.showcase.person.CreatePerson" method="{1}">
<result type="redirect">listPeople.action</result>
<result name="input" type="freemarker">newPerson.ftl</result>
</action>
Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts-token.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-token.xml?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-token.xml
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-token.xml Mon
Jul 17 21:15:02 2006
@@ -6,7 +6,7 @@
<package name="token" extends="struts-default" namespace="/token">
- <action name="tokenPrepare"
class="org.apache.struts2.showcase.token.TokenAction">
+ <action name="tokenPrepare!*"
class="org.apache.struts2.showcase.token.TokenAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<result name="input">example1.jsp</result>
</action>
@@ -20,7 +20,7 @@
- <action name="tokenPrepare2"
class="org.apache.struts2.showcase.token.TokenAction">
+ <action name="tokenPrepare2!*"
class="org.apache.struts2.showcase.token.TokenAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<result name="input">example2.jsp</result>
</action>
@@ -34,7 +34,7 @@
- <action name="tokenPrepare3"
class="org.apache.struts2.showcase.token.TokenAction">
+ <action name="tokenPrepare3!*"
class="org.apache.struts2.showcase.token.TokenAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<result name="input">example3.jsp</result>
</action>
@@ -47,7 +47,7 @@
</action>
- <action name="tokenPrepare4"
class="org.apache.struts2.showcase.token.TokenAction">
+ <action name="tokenPrepare4!*"
class="org.apache.struts2.showcase.token.TokenAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="createSession"/> <!-- we must have a
session when using freemarker and the @ww.token tag -->
<result name="input" type="freemarker">example4.ftl</result>
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml Mon Jul
17 21:15:02 2006
@@ -6,12 +6,12 @@
<filter>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
@@ -23,7 +23,7 @@
<filter-mapping>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
@@ -33,7 +33,7 @@
</filter-mapping>
<filter-mapping>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
@@ -88,7 +88,7 @@
<!-- SNIPPET START: example.velocity.filter.chain
<filter>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
@@ -96,12 +96,12 @@
<filter-class>org.apache.struts2.sitemesh.VelocityPageFilter</filter-class>
</filter>
<filter>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
@@ -109,14 +109,14 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
END SNIPPET: example.velocity.filter.chain -->
<!-- SNIPPET START: example.freemarker.filter.chain
<filter>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
@@ -124,12 +124,12 @@
<filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</filter-class>
</filter>
<filter>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
- <filter-name>action2-cleanup</filter-name>
+ <filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
@@ -137,7 +137,7 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>action2</filter-name>
+ <filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
END SNIPPET: example.freemarker.filter.chain -->
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=422956&r1=422955&r2=422956&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
Mon Jul 17 21:15:02 2006
@@ -121,4 +121,7 @@
/** 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 =
"struts.compatibilityMode";
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
Mon Jul 17 21:15:02 2006
@@ -326,6 +326,7 @@
* @param scheme http or https
* @param includeContext should the context path be included or not
* @param encodeResult should the url be encoded
+ * @deprecated Since Struts 2.0.0
* @return the action url.
*/
protected String determineActionURL(String action, String namespace,
String method,
@@ -337,6 +338,25 @@
ActionMapper mapper = ActionMapperFactory.getMapper();
String uri = mapper.getUriFromActionMapping(mapping);
return UrlHelper.buildUrl(uri, req, res, parameters, scheme,
includeContext, encodeResult);
+ }
+
+ /**
+ * Renders an action URL by consulting the [EMAIL PROTECTED]
org.apache.struts2.dispatcher.mapper.ActionMapper}.
+ * @param action the action
+ * @param namespace the namespace
+ * @param req HTTP request
+ * @param res HTTP response
+ * @param parameters parameters
+ * @param scheme http or https
+ * @param includeContext should the context path be included or not
+ * @param encodeResult should the url be encoded
+ * @return the action url.
+ */
+ protected String determineActionURL(String action, String namespace,
+ HttpServletRequest req,
HttpServletResponse res, Map parameters, String scheme,
+ boolean includeContext, boolean
encodeResult) {
+ return determineActionURL(action, namespace, null, req, res,
parameters,
+ scheme, includeContext, encodeResult);
}
/**
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=422956&r1=422955&r2=422956&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
Mon Jul 17 21:15:02 2006
@@ -31,6 +31,7 @@
import com.opensymphony.xwork2.validator.ValidationInterceptor;
import com.opensymphony.xwork2.validator.Validator;
import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapperFactory;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -98,6 +99,13 @@
protected String portletMode;
protected String windowState;
protected String acceptcharset;
+ protected static boolean compatibilityMode = false;
+
+ static {
+ if
(org.apache.struts2.config.Configuration.isSet(StrutsConstants.STRUTS_COMPATIBILITY_MODE))
{
+ compatibilityMode =
"true".equals(org.apache.struts2.config.Configuration.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE));
+ }
+ }
public Form(OgnlValueStack stack, HttpServletRequest request,
HttpServletResponse response) {
super(stack, request, response);
@@ -192,7 +200,7 @@
}
String actionMethod = "";
- if (action.indexOf("!") != -1) {
+ if (compatibilityMode && action.indexOf("!") != -1) {
int endIdx = action.lastIndexOf("!");
actionMethod = action.substring(endIdx + 1, action.length());
action = action.substring(0, endIdx);
@@ -403,6 +411,7 @@
* HTML form method attribute
*
* @a2.tagattribute required="false"
+ * @deprecated Since Struts 2.0.0
*/
public void setMethod(String method) {
this.method = method;
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
Mon Jul 17 21:15:02 2006
@@ -288,6 +288,7 @@
/**
* The method of action to use
* @a2.tagattribute required="false"
+ * @deprecated Since Struts 2.0.0
*/
public void setMethod(String method) {
this.method = method;
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
Mon Jul 17 21:15:02 2006
@@ -83,6 +83,7 @@
private ConfigurationManager configurationManager;
private boolean portletSupportActive;
private boolean devMode = false;
+ private boolean compatibilityMode = true;
// used to get WebLogic to play nice
private boolean paramsWorkaroundEnabled = false;
@@ -255,6 +256,8 @@
}
configurationManager = new ConfigurationManager();
+
+ // Load old xwork files
configurationManager.addConfigurationProvider(new
XmlConfigurationProvider("xwork.xml", false));
// Load Struts config files
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=422956&r1=422955&r2=422956&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
Mon Jul 17 21:15:02 2006
@@ -146,50 +146,59 @@
static final String REDIRECT_PREFIX = "redirect:";
static final String REDIRECT_ACTION_PREFIX = "redirect-action:";
- static PrefixTrie prefixTrie = new PrefixTrie() {
- {
- put(METHOD_PREFIX, new ParameterAction() {
- public void execute(String key, ActionMapping mapping) {
- mapping.setMethod(key.substring(METHOD_PREFIX.length()));
+ private PrefixTrie prefixTrie = null;
+ private boolean compatibilityMode = false;
+ public DefaultActionMapper() {
+ if (Configuration.isSet(StrutsConstants.STRUTS_COMPATIBILITY_MODE)) {
+ compatibilityMode =
"true".equals(Configuration.get(StrutsConstants.STRUTS_COMPATIBILITY_MODE));
+ }
+ 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(ACTION_PREFIX, new ParameterAction() {
- public void execute(String key, ActionMapping mapping) {
- String name = key.substring(ACTION_PREFIX.length());
- int bang = name.indexOf('!');
- if (bang != -1) {
- String method = name.substring(bang + 1);
- mapping.setMethod(method);
- name = name.substring(0, bang);
+
+ put(ACTION_PREFIX, new ParameterAction() {
+ public void execute(String key, ActionMapping mapping) {
+ String name = key.substring(ACTION_PREFIX.length());
+ int bang = name.indexOf('!');
+ if (bang != -1) {
+ String method = name.substring(bang + 1);
+ mapping.setMethod(method);
+ name = name.substring(0, bang);
+ }
+
+ mapping.setName(name);
}
-
- mapping.setName(name);
- }
- });
-
- put(REDIRECT_PREFIX, new ParameterAction() {
- public void execute(String key, ActionMapping mapping) {
- ServletRedirectResult redirect = new
ServletRedirectResult();
-
redirect.setLocation(key.substring(REDIRECT_PREFIX.length()));
- mapping.setResult(redirect);
- }
- });
-
- put(REDIRECT_ACTION_PREFIX, new ParameterAction() {
- public void execute(String key, ActionMapping mapping) {
- String location =
key.substring(REDIRECT_ACTION_PREFIX.length());
- ServletRedirectResult redirect = new
ServletRedirectResult();
- String extension = getDefaultExtension();
- if (extension != null) {
- location += "." + extension;
+ });
+
+ put(REDIRECT_PREFIX, new ParameterAction() {
+ public void execute(String key, ActionMapping mapping) {
+ ServletRedirectResult redirect = new
ServletRedirectResult();
+
redirect.setLocation(key.substring(REDIRECT_PREFIX.length()));
+ mapping.setResult(redirect);
}
- redirect.setLocation(location);
- mapping.setResult(redirect);
- }
- });
- }
- };
+ });
+
+ put(REDIRECT_ACTION_PREFIX, new ParameterAction() {
+ public void execute(String key, ActionMapping mapping) {
+ String location =
key.substring(REDIRECT_ACTION_PREFIX.length());
+ ServletRedirectResult redirect = new
ServletRedirectResult();
+ String extension = getDefaultExtension();
+ if (extension != null) {
+ location += "." + extension;
+ }
+ redirect.setLocation(location);
+ mapping.setResult(redirect);
+ }
+ });
+ }
+ };
+ }
/* (non-Javadoc)
* @see
org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest)
@@ -206,12 +215,14 @@
return null;
}
- // 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));
+ 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));
+ }
}
return mapping;
}
@@ -223,7 +234,7 @@
* @param request The request
* @param mapping The action mapping
*/
- public static void handleSpecialParameters(HttpServletRequest request,
ActionMapping mapping) {
+ public void handleSpecialParameters(HttpServletRequest request,
ActionMapping mapping) {
// handle special parameter prefixes.
Map parameterMap = request.getParameterMap();
for (Iterator iterator = parameterMap.keySet().iterator();
iterator.hasNext();) {
@@ -348,8 +359,10 @@
}
uri.append(name);
- if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
- uri.append("!").append(mapping.getMethod());
+ if (compatibilityMode) {
+ if (null != mapping.getMethod() &&
!"".equals(mapping.getMethod())) {
+ uri.append("!").append(mapping.getMethod());
+ }
}
String extension = getDefaultExtension();
Modified:
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
(original)
+++
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
Mon Jul 17 21:15:02 2006
@@ -87,6 +87,12 @@
### them right away.
struts.devMode = false
+### when set to true, Struts will act in a manner more friendly to WebWork 2.2
+### applications. Specifically, it allows for the "action!method" URL syntax
+### that allows methods to be specified in the URL. This behavior has been
+### deprecated in favor of explicit wildcards where needed.
+struts.compatibilityMode = false
+
### when set to true, resource bundles will be reloaded on _every_ request.
### this is good during development, but should never be used in production
struts.i18n.reload=false
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DefautActionMapperTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DefautActionMapperTest.java?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DefautActionMapperTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DefautActionMapperTest.java
Mon Jul 17 21:15:02 2006
@@ -18,6 +18,8 @@
package org.apache.struts2.dispatcher;
import com.mockobjects.servlet.MockHttpServletRequest;
+
+import org.apache.struts2.StrutsStatics;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.config.Configuration;
@@ -65,8 +67,7 @@
ActionMapping mapping = mapper.getMapping(req);
assertEquals("/my/namespace", mapping.getNamespace());
- assertEquals("actionName", mapping.getName());
- assertEquals("add", mapping.getMethod());
+ assertEquals("actionName!add", mapping.getName());
}
public void testGetUri() throws Exception {
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=422956&r1=422955&r2=422956&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
Mon Jul 17 21:15:02 2006
@@ -69,19 +69,6 @@
// ===========================
// === test special prefix ===
// ===========================
- public void testMethodPrefix() throws Exception {
- Map parameterMap = new HashMap();
- parameterMap.put(DefaultActionMapper.METHOD_PREFIX + "myMethod", "");
-
- StrutsMockHttpServletRequest request = new
StrutsMockHttpServletRequest();
- request.setParameterMap(parameterMap);
- request.setupGetServletPath("/someServletPath.action");
-
- DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
- ActionMapping actionMapping = defaultActionMapper.getMapping(request);
-
- assertEquals(actionMapping.getMethod(), "myMethod");
- }
public void testActionPrefix() throws Exception {
Map parameterMap = new HashMap();
@@ -133,23 +120,6 @@
// TODO: need to test location but there's noaccess to the
property/method, unless we use reflection
}
-
- // ==========================
- // === test action!method ===
- // ==========================
- public void testActionBangMethod() throws Exception {
-
- StrutsMockHttpServletRequest request = new
StrutsMockHttpServletRequest();
- request.setupGetServletPath("/someName!someMethod.action");
-
- DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
- ActionMapping actionMapping = defaultActionMapper.getMapping(request);
-
- assertEquals(actionMapping.getMethod(), "someMethod");
- assertEquals(actionMapping.getName(), "someName");
- }
-
-
public void testGetUriFromActionMapper1() throws Exception {
DefaultActionMapper mapper = new DefaultActionMapper();
ActionMapping actionMapping = new ActionMapping();
@@ -158,7 +128,7 @@
actionMapping.setNamespace("/myNamespace");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myNamespace/myActionName!myMethod.action", uri);
+ assertEquals("/myNamespace/myActionName.action", uri);
}
public void testGetUriFromActionMapper2() throws Exception {
@@ -169,7 +139,7 @@
actionMapping.setNamespace("/");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myActionName!myMethod.action", uri);
+ assertEquals("/myActionName.action", uri);
}
public void testGetUriFromActionMapper3() throws Exception {
@@ -180,7 +150,7 @@
actionMapping.setNamespace("");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myActionName!myMethod.action", uri);
+ assertEquals("/myActionName.action", uri);
}
@@ -213,7 +183,7 @@
actionMapping.setNamespace("/myNamespace");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myNamespace/myActionName!myMethod.action?test=bla",
uri);
+ assertEquals("/myNamespace/myActionName.action?test=bla", uri);
}
public void testGetUriFromActionMapper7() throws Exception {
@@ -224,7 +194,7 @@
actionMapping.setNamespace("/");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myActionName!myMethod.action?test=bla", uri);
+ assertEquals("/myActionName.action?test=bla", uri);
}
public void testGetUriFromActionMapper8() throws Exception {
@@ -235,7 +205,7 @@
actionMapping.setNamespace("");
String uri = mapper.getUriFromActionMapping(actionMapping);
- assertEquals("/myActionName!myMethod.action?test=bla", uri);
+ assertEquals("/myActionName.action?test=bla", uri);
}
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
Mon Jul 17 21:15:02 2006
@@ -50,7 +50,7 @@
tag.setName("myForm");
tag.setMethod("POST");
tag.setAcceptcharset("UTF-8");
- tag.setAction("testAction!myLittleMethod");
+ tag.setAction("testAction");
tag.setEnctype("myEncType");
tag.setTitle("mytitle");
tag.setOnsubmit("submitMe()");
@@ -71,7 +71,7 @@
tag.setNamespace("/testNamespace");
tag.setMethod("POST");
tag.setAcceptcharset("UTF-8");
- tag.setAction("testNamespaceAction!myLittleMethod");
+ tag.setAction("testNamespaceAction");
tag.setEnctype("myEncType");
tag.setTitle("mytitle");
tag.setOnsubmit("submitMe()");
Modified:
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-10.txt
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-10.txt?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-10.txt
(original)
+++
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-10.txt
Mon Jul 17 21:15:02 2006
@@ -1,4 +1,4 @@
-<form id="testNamespaceAction" name="myForm" onsubmit="submitMe(); return
true;" action="/testNamespace/testNamespaceAction!myLittleMethod.action"
method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<form id="testNamespaceAction" name="myForm" onsubmit="submitMe(); return
true;" action="/testNamespace/testNamespaceAction.action" method="POST"
enctype="myEncType" title="mytitle" accept-charset="UTF-8">
<table class="wwFormTable">
</table>
</form>
Modified:
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-9.txt
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-9.txt?rev=422956&r1=422955&r2=422956&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-9.txt
(original)
+++
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-9.txt
Mon Jul 17 21:15:02 2006
@@ -1,4 +1,4 @@
-<form id="testAction" name="myForm" onsubmit="submitMe(); return true;"
action="/testAction!myLittleMethod.action" method="POST" enctype="myEncType"
title="mytitle" accept-charset="UTF-8">
+<form id="testAction" name="myForm" onsubmit="submitMe(); return true;"
action="/testAction.action" method="POST" enctype="myEncType" title="mytitle"
accept-charset="UTF-8">
<table class="wwFormTable">
</table>
</form>