Author: mrdon
Date: Thu Jul 28 15:43:48 2005
New Revision: 226273
URL: http://svn.apache.org/viewcvs?rev=226273&view=rev
Log:
Adding better documentation and debugging to action config matcher.
Patch provided by Laurie Harper.
Modified:
struts/core/trunk/doc/userGuide/building_controller.xml
struts/core/trunk/src/share/org/apache/struts/config/ActionConfigMatcher.java
Modified: struts/core/trunk/doc/userGuide/building_controller.xml
URL:
http://svn.apache.org/viewcvs/struts/core/trunk/doc/userGuide/building_controller.xml?rev=226273&r1=226272&r2=226273&view=diff
==============================================================================
--- struts/core/trunk/doc/userGuide/building_controller.xml (original)
+++ struts/core/trunk/doc/userGuide/building_controller.xml Thu Jul 28 15:43:48
2005
@@ -1521,7 +1521,15 @@
For the rest of the request, Struts will see the action mapping and its
action forwards containing the new values.
</p>
-
+
+ <p>
+ Mappings are matched against the request in the order they appear in
+ the Struts configuration file. If more than one pattern matches the
+ last one wins, so less specific patterns must appear before more
+ specific ones. However, if the request URL can be matched against
+ a path without any wildcards in it, no wildcard matching is performed
+ and order in not important.
+ </p>
<p>
Wildcard patterns can contain one or more of the following special tokens:
</p>
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=226273&r1=226272&r2=226273&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
Thu Jul 28 15:43:48 2005
@@ -37,7 +37,9 @@
/**
* Matches paths against pre-compiled wildcard expressions pulled from
* action configs. It uses the wildcard matcher from the Apache
- * Cocoon project.
+ * Cocoon project. Patterns will be matched in the order they exist
+ * in the Struts config file. The last match wins, so more specific
+ * patterns should be defined after less specific patterns.
*
* @since Struts 1.2
*/
@@ -109,6 +111,10 @@
for (Iterator i = compiledPaths.iterator(); i.hasNext();) {
m = (Mapping) i.next();
if (wildcard.match(vars, path, m.getPattern())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Path matches pattern '"
+ + m.getActionConfig().getPath() + "'");
+ }
config = convertActionConfig(
path,
(ActionConfig) m.getActionConfig(),
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]