You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hr...@apache.org on 2005/08/14 23:24:53 UTC
svn commit: r232648 - in /struts/core/trunk/src:
share/org/apache/struts/action/ share/org/apache/struts/actions/
share/org/apache/struts/config/ share/org/apache/struts/mock/
share/org/apache/struts/util/ test/org/apache/struts/config/
test/org/apache...
Author: hrabago
Date: Sun Aug 14 14:24:39 2005
New Revision: 232648
URL: http://svn.apache.org/viewcvs?rev=232648&view=rev
Log:
Remove contextRelative and references to it.
Modified:
struts/core/trunk/src/share/org/apache/struts/action/ActionForward.java
struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java
struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java
struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java
struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java
struts/core/trunk/src/share/org/apache/struts/mock/TestMockBase.java
struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java
struts/core/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java
struts/core/trunk/src/test/org/apache/struts/util/TestRequestUtils.java
Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionForward.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionForward.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/ActionForward.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/ActionForward.java Sun Aug 14 14:24:39 2005
@@ -122,27 +122,6 @@
/**
- * <p>Construct a new instance with the specified values.</p>
- *
- * @param name Name of this instance
- * @param path Path for this instance
- * @param redirect Redirect flag for this instance
- * @param contextRelative Context relative flag for this instance
- * @deprecated Use module rather than contextRelative
- */
- public ActionForward(String name, String path, boolean redirect,
- boolean contextRelative) {
-
- super();
- setName(name);
- setPath(path);
- setRedirect(redirect);
- setContextRelative(contextRelative);
-
- }
-
-
- /**
* Construct a new instance with the specified values.
*
* @param name Name of this forward
@@ -172,7 +151,6 @@
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
- setContextRelative(copyMe.getContextRelative());
}
}
Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java Sun Aug 14 14:24:39 2005
@@ -132,7 +132,6 @@
public ActionRedirect(ForwardConfig baseConfig) {
setName(baseConfig.getName());
setPath(baseConfig.getPath());
- setContextRelative(baseConfig.getContextRelative());
setModule(baseConfig.getModule());
setRedirect(true);
initializeParameters();
Modified: struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java Sun Aug 14 14:24:39 2005
@@ -90,7 +90,6 @@
// Let the controller handle the request
ActionForward retVal = new ActionForward(path);
- retVal.setContextRelative(true);
return retVal;
}
Modified: struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java Sun Aug 14 14:24:39 2005
@@ -168,7 +168,6 @@
ForwardConfig cfg;
for (int x = 0; x < fConfigs.length; x++) {
cfg = new ActionForward();
- cfg.setContextRelative(fConfigs[x].getContextRelative());
cfg.setName(fConfigs[x].getName());
cfg.setPath(convertParam(fConfigs[x].getPath(), vars));
cfg.setRedirect(fConfigs[x].getRedirect());
Modified: struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java Sun Aug 14 14:24:39 2005
@@ -62,27 +62,7 @@
}
-
- /**
- * Construct a new instance with the specified values.
- *
- * @param name Name of this forward
- * @param path Path to which control should be forwarded or redirected
- * @param redirect Should we do a redirect?
- * @param contextRelative Is this path context relative?
- * @deprecated Use module rather than contextRelative
- */
- public ForwardConfig(String name, String path, boolean redirect,
- boolean contextRelative) {
-
- super();
- setName(name);
- setPath(path);
- setRedirect(redirect);
- setContextRelative(contextRelative);
-
- }
-
+
/**
* <p>Construct a new instance with the specified values.</p>
* @param name Name of this forward
@@ -105,30 +85,6 @@
/**
- * Should the value of the <code>path</code> property be considered
- * context-relative if it starts with a slash (and therefore not
- * prefixed with the module prefix?
- * @deprecated Use module property instead; will be removed in a release following 1.2.0.
- */
- protected boolean contextRelative = false;
-
- /**
- * @deprecated Use module property instead; will be removed in a release following 1.2.0.
- */
- public boolean getContextRelative() {
- return (this.contextRelative);
- }
-
- /**
- * @deprecated Use module property instead; will be removed in a release following 1.2.0.
- */
- public void setContextRelative(boolean contextRelative) {
- throwIfConfigured();
- this.contextRelative = contextRelative;
- }
-
-
- /**
* The name of the ForwardConfig that this object should inherit properties
* from.
*/
@@ -424,10 +380,6 @@
setCommand(config.getCommand());
}
- if (!getContextRelative()) {
- setContextRelative(config.getContextRelative());
- }
-
if (getModule() == null) {
setModule(config.getModule());
}
@@ -533,8 +485,6 @@
sb.append(this.path);
sb.append(",redirect=");
sb.append(this.redirect);
- sb.append(",contextRelative=");
- sb.append(this.contextRelative);
sb.append(",module=");
sb.append(this.module);
sb.append(",extends=");
Modified: struts/core/trunk/src/share/org/apache/struts/mock/TestMockBase.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/mock/TestMockBase.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/mock/TestMockBase.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/mock/TestMockBase.java Sun Aug 14 14:24:39 2005
@@ -128,19 +128,19 @@
// Forward "external" to "http://jakarta.apache.org/"
moduleConfig.addForwardConfig
(new ActionForward("external", "http://jakarta.apache.org/",
- false, false));
+ false));
// Forward "foo" to "/bar.jsp"
moduleConfig.addForwardConfig
- (new ActionForward("foo", "/bar.jsp", false, false));
+ (new ActionForward("foo", "/bar.jsp", false));
// Forward "relative1" to "relative.jsp" non-context-relative
moduleConfig.addForwardConfig
- (new ActionForward("relative1", "relative.jsp", false, false));
+ (new ActionForward("relative1", "relative.jsp", false));
// Forward "relative2" to "relative.jsp" context-relative
moduleConfig.addForwardConfig
- (new ActionForward("relative2", "relative.jsp", false, true));
+ (new ActionForward("relative2", "relative.jsp", false));
// Form Bean "static" is a standard ActionForm subclass
formBean = new ActionFormBean
@@ -222,38 +222,36 @@
moduleConfig.addForwardConfig
(new ForwardConfig("moduleForward",
"/module/forward",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
moduleConfig.addForwardConfig
(new ForwardConfig("moduleRedirect",
"/module/redirect",
- true, // Redirect
- false)); // Not context relative
+ true)); // Redirect, same module
moduleConfig.addForwardConfig
(new ForwardConfig("contextForward",
- "/context/forward",
+ "/forward",
false, // No redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig.addForwardConfig
(new ForwardConfig("contextRedirect",
- "/context/redirect",
+ "/redirect",
true, // Redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig.addForwardConfig
(new ForwardConfig("moduleNoslash",
"module/noslash",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
+
moduleConfig.addForwardConfig
(new ForwardConfig("contextNoslash",
- "context/noslash",
+ "noslash",
false, // No redirect
- true)); // Not context relative
+ "/context")); // Specify module
}
@@ -272,19 +270,19 @@
// Forward "external" to "http://jakarta.apache.org/"
moduleConfig2.addForwardConfig
(new ActionForward("external", "http://jakarta.apache.org/",
- false, false));
+ false));
// Forward "foo" to "/baz.jsp" (different from default)
moduleConfig2.addForwardConfig
- (new ActionForward("foo", "/baz.jsp", false, false));
+ (new ActionForward("foo", "/baz.jsp", false));
// Forward "relative1" to "relative.jsp" non-context-relative
moduleConfig2.addForwardConfig
- (new ActionForward("relative1", "relative.jsp", false, false));
+ (new ActionForward("relative1", "relative.jsp", false));
// Forward "relative2" to "relative.jsp" context-relative
moduleConfig2.addForwardConfig
- (new ActionForward("relative2", "relative.jsp", false, true));
+ (new ActionForward("relative2", "relative.jsp", false));
// Form Bean "static" is a standard ActionForm subclass (same as default)
formBean = new ActionFormBean
@@ -331,38 +329,36 @@
moduleConfig2.addForwardConfig
(new ForwardConfig("moduleForward",
"/module/forward",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
moduleConfig2.addForwardConfig
(new ForwardConfig("moduleRedirect",
"/module/redirect",
- true, // Redirect
- false)); // Not context relative
+ true)); // Redirect, same module
+
moduleConfig2.addForwardConfig
(new ForwardConfig("contextForward",
- "/context/forward",
+ "/forward",
false, // No redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig2.addForwardConfig
(new ForwardConfig("contextRedirect",
- "/context/redirect",
+ "/redirect",
true, // Redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig2.addForwardConfig
(new ForwardConfig("moduleNoslash",
"module/noslash",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
moduleConfig2.addForwardConfig
(new ForwardConfig("contextNoslash",
- "context/noslash",
+ "noslash",
false, // No redirect
- true)); // Not context relative
+ "/context")); // Specify module
}
@@ -389,38 +385,35 @@
moduleConfig3.addForwardConfig
(new ForwardConfig("moduleForward",
"/module/forward",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
moduleConfig3.addForwardConfig
(new ForwardConfig("moduleRedirect",
"/module/redirect",
- true, // Redirect
- false)); // Not context relative
+ true)); // Redirect, same module
moduleConfig3.addForwardConfig
(new ForwardConfig("contextForward",
- "/context/forward",
+ "/forward",
false, // No redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig3.addForwardConfig
(new ForwardConfig("contextRedirect",
- "/context/redirect",
+ "/redirect",
true, // Redirect
- true)); // Context relative
+ "/context")); // Specify module
moduleConfig3.addForwardConfig
(new ForwardConfig("moduleNoslash",
"module/noslash",
- false, // No redirect
- false)); // Not context relative
+ false)); // No redirect, same module
moduleConfig3.addForwardConfig
(new ForwardConfig("contextNoslash",
- "context/noslash",
- false, // No redirect
- true)); // Not context relative
+ "noslash",
+ false, // No redirect
+ "/context")); // specify module
}
Modified: struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java Sun Aug 14 14:24:39 2005
@@ -786,15 +786,7 @@
}
}
- // Handle a ForwardConfig marked as context relative
StringBuffer sb = new StringBuffer();
- if (forward.getContextRelative()) {
- if (!path.startsWith("/")) {
- sb.append("/");
- }
- sb.append(path);
- return (sb.toString());
- }
// Calculate a context relative path for this ForwardConfig
String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern();
Modified: struts/core/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java (original)
+++ struts/core/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java Sun Aug 14 14:24:39 2005
@@ -148,7 +148,6 @@
ForwardConfig cfg = fConfigs[x];
if ("name".equals(cfg.getName())) {
found = true;
- assertTrue("ContextRelative isn't correct", cfg.getContextRelative());
assertTrue("Path hasn't been replaced", "path,Bar".equals(cfg.getPath()));
}
}
@@ -187,13 +186,11 @@
mapping.setInput("input,{1}");
ForwardConfig cfg = new ActionForward();
- cfg.setContextRelative(true);
cfg.setName("name");
cfg.setPath("path,{1}");
mapping.addForwardConfig(cfg);
cfg = new ActionForward();
- cfg.setContextRelative(true);
cfg.setName("name2");
cfg.setPath("path2");
mapping.addForwardConfig(cfg);
Modified: struts/core/trunk/src/test/org/apache/struts/util/TestRequestUtils.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/util/TestRequestUtils.java?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- struts/core/trunk/src/test/org/apache/struts/util/TestRequestUtils.java (original)
+++ struts/core/trunk/src/test/org/apache/struts/util/TestRequestUtils.java Sun Aug 14 14:24:39 2005
@@ -398,7 +398,7 @@
ForwardConfig forward = null;
String result = null;
- // redirect=false, contextRelative=false
+ // redirect=false, module=null
forward = moduleConfig.findForwardConfig("moduleForward");
assertNotNull("moduleForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -407,7 +407,7 @@
"/module/forward",
result);
- // redirect=true, contextRelative=false
+ // redirect=true, module=null
forward = moduleConfig.findForwardConfig("moduleRedirect");
assertNotNull("moduleRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -416,7 +416,7 @@
"/module/redirect",
result);
- // redirect=false, contextRelative=true
+ // redirect=false, module=/context
forward = moduleConfig.findForwardConfig("contextForward");
assertNotNull("contextForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -425,7 +425,7 @@
"/context/forward",
result);
- // redirect=true, contextRelative=true
+ // redirect=true, module=/context
forward = moduleConfig.findForwardConfig("contextRedirect");
assertNotNull("contextRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -434,7 +434,7 @@
"/context/redirect",
result);
- // noslash, contextRelative=false
+ // noslash, module=null
forward = moduleConfig.findForwardConfig("moduleNoslash");
assertNotNull("moduleNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -443,7 +443,7 @@
"/module/noslash",
result);
- // noslash, contextRelative=true
+ // noslash, module=/
forward = moduleConfig.findForwardConfig("contextNoslash");
assertNotNull("contextNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -463,7 +463,7 @@
ForwardConfig forward = null;
String result = null;
- // redirect=false, contextRelative=false
+ // redirect=false, module=null
forward = moduleConfig2.findForwardConfig("moduleForward");
assertNotNull("moduleForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -472,7 +472,7 @@
"/2/module/forward",
result);
- // redirect=true, contextRelative=false
+ // redirect=true, module=null
forward = moduleConfig2.findForwardConfig("moduleRedirect");
assertNotNull("moduleRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -481,7 +481,7 @@
"/2/module/redirect",
result);
- // redirect=false, contextRelative=true
+ // redirect=false, module=/context
forward = moduleConfig2.findForwardConfig("contextForward");
assertNotNull("contextForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -490,7 +490,7 @@
"/context/forward",
result);
- // redirect=true, contextRelative=true
+ // redirect=true, module=/context
forward = moduleConfig2.findForwardConfig("contextRedirect");
assertNotNull("contextRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -499,7 +499,7 @@
"/context/redirect",
result);
- // noslash, contextRelative=false
+ // noslash, module=null
forward = moduleConfig2.findForwardConfig("moduleNoslash");
assertNotNull("moduleNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -508,7 +508,7 @@
"/2/module/noslash",
result);
- // noslash, contextRelative=true
+ // noslash, module=/
forward = moduleConfig2.findForwardConfig("contextNoslash");
assertNotNull("contextNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -528,7 +528,7 @@
ForwardConfig forward = null;
String result = null;
- // redirect=false, contextRelative=false
+ // redirect=false, module=null
forward = moduleConfig3.findForwardConfig("moduleForward");
assertNotNull("moduleForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -537,7 +537,7 @@
"/forwarding/3/module/forward",
result);
- // redirect=true, contextRelative=false
+ // redirect=true, module=null
forward = moduleConfig3.findForwardConfig("moduleRedirect");
assertNotNull("moduleRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -546,25 +546,25 @@
"/forwarding/3/module/redirect",
result);
- // redirect=false, contextRelative=true
+ // redirect=false, module=/context
forward = moduleConfig3.findForwardConfig("contextForward");
assertNotNull("contextForward found", forward);
result = RequestUtils.forwardURL(request, forward, null);
assertNotNull("contextForward computed", result);
assertEquals("contextForward value",
- "/context/forward",
+ "/forwarding/context/forward",
result);
- // redirect=true, contextRelative=true
+ // redirect=true, module=/context
forward = moduleConfig3.findForwardConfig("contextRedirect");
assertNotNull("contextRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, null);
assertNotNull("contextRedirect computed", result);
assertEquals("contextRedirct value",
- "/context/redirect",
+ "/forwarding/context/redirect",
result);
- // noslash, contextRelative=false
+ // noslash, module=null
forward = moduleConfig3.findForwardConfig("moduleNoslash");
assertNotNull("moduleNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
@@ -573,15 +573,14 @@
"/forwarding/3/module/noslash",
result);
- // noslash, contextRelative=true
+ // noslash, module=/
forward = moduleConfig3.findForwardConfig("contextNoslash");
assertNotNull("contextNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, null);
assertNotNull("contextNoslash computed", result);
assertEquals("contextNoslash value",
- "/context/noslash",
+ "/forwarding/context/noslash",
result);
-
}
@@ -611,22 +610,22 @@
"/forwarding/3/module/redirect",
result);
- // redirect=false, contextRelative=true, link to module 3
+ // redirect=false, module=/context
forward = moduleConfig3.findForwardConfig("contextForward");
assertNotNull("contextForward found", forward);
result = RequestUtils.forwardURL(request, forward, moduleConfig3);
assertNotNull("contextForward computed", result);
assertEquals("contextForward value",
- "/context/forward",
+ "/forwarding/context/forward",
result);
- // redirect=true, contextRelative=true, link to module 3
+ // redirect=true, module=/context
forward = moduleConfig3.findForwardConfig("contextRedirect");
assertNotNull("contextRedirect found", forward);
result = RequestUtils.forwardURL(request, forward, moduleConfig3);
assertNotNull("contextRedirect computed", result);
assertEquals("contextRedirct value",
- "/context/redirect",
+ "/forwarding/context/redirect",
result);
// noslash, contextRelative=false, link to module 3
@@ -638,13 +637,13 @@
"/forwarding/3/module/noslash",
result);
- // noslash, contextRelative=true, link to module 3
+ // noslash, module=/
forward = moduleConfig3.findForwardConfig("contextNoslash");
assertNotNull("contextNoslash found", forward);
result = RequestUtils.forwardURL(request, forward, moduleConfig3);
assertNotNull("contextNoslash computed", result);
assertEquals("contextNoslash value",
- "/context/noslash",
+ "/forwarding/context/noslash",
result);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org