craigmcc 2003/02/08 13:20:20
Modified: src/share/org/apache/struts/util RequestUtils.java
Log:
Formally document the behavior of forwardURL() so that people will know
what to expect (and what we test for). No functionality changes.
Revision Changes Path
1.83 +38 -8
jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
Index: RequestUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- RequestUtils.java 7 Feb 2003 05:25:23 -0000 1.82
+++ RequestUtils.java 8 Feb 2003 21:20:19 -0000 1.83
@@ -1350,10 +1350,40 @@
}
/**
- * Return the context-relative URL that corresponds to the specified
- * {@link ForwardConfig}, relative to the module associated
- * with the current {@link ModuleConfig}. The forward path is
- * gracefully prefixed with a '/' according to the boolean.
+ * <p>Return the context-relative URL that corresponds to the specified
+ * {@link ForwardConfig}, calculated based on the properties of the
+ * {@link ForwardConfig} instance as follows:</p>
+ * <ul>
+ * <li>If the <code>contextRelative</code> property is set, it is
+ * assumed that the <code>path</code> property contains a path
+ * that is already context-relative:
+ * <ul>
+ * <li>If the <code>path</code> property value starts with a slash,
+ * it is returned unmodified.</li>
+ * <li>If the <code>path</code> property value does not start
+ * with a slash, a slash is prepended.</li>
+ * </ul></li>
+ * <li>Acquire the <code>forwardPattern</code> property from the
+ * <code>ControllerConfig</code> for the application module used
+ * to process this request. If no pattern was configured, default
+ * to a pattern of <code>$M$P</code>, which is compatible with the
+ * hard-coded mapping behavior in Struts 1.0.</li>
+ * <li>Process the acquired <code>forwardPattern</code>, performing the
+ * following substitutions:
+ * <ul>
+ * <li><strong>$M</strong> - Replaced by the module prefix for the
+ * application module processing this request.</li>
+ * <li><strong>$P</strong> - Replaced by the <code>path</code>
+ * property of the specified {@link ForwardConfig}, prepended
+ * with a slash if it does not start with one.</li>
+ * <li><strong>$$</strong> - Replaced by a single dollar sign
+ * character.</li>
+ * <li><strong>$x</strong> (where "x" is any charater not listed
+ * above) - Silently omit these two characters from the result
+ * value. (This has the side effect of causing all other
+ * $+letter combinations to be reserved.)</li>
+ * </ul></li>
+ * </ul>
*
* @param request The servlet request we are processing
* @param forward ForwardConfig to be evaluated
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]