1. opensymphony
  2. xwork

Commits

mrdon  committed 2d5d373

Enable a compatiblity mode which adds a wildcard to every non-wildcard action to support
legacy "!" method syntax

Issue number: XW-391

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1041e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits e6dc876
  • Branches master

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork/config/providers/XmlConfigurationProvider.java

View file
  • Ignore whitespace
     private Configuration configuration;
     private Set includedFileNames = new TreeSet();
     private String configFileName = "xwork.xml";
-
+    private boolean compatMode = false;
 
     public XmlConfigurationProvider() {
     }
     public XmlConfigurationProvider(String filename) {
         this.configFileName = filename;
     }
+    
+    public void setCompatibilityMode(boolean mode) {
+        this.compatMode = mode;
+    }
 
 
     public void destroy() {
         if (!verifyAction(className, name, location)) {
             return;
         }
+        
+        // If in XWork 1.x compatibility mode, add a wildcard pattern to
+        // support legacy method declarations
+        if (compatMode) {
+            if (name.indexOf('*') == -1 && methodName == null) {
+                name += "!*";
+                methodName = "{1}";
+            }
+        }
 
         Map actionParams = XmlHelper.getParams(actionElement);
 
 
         return InterceptorBuilder.constructInterceptorReference(context, refName, refParams);
     }
+    
 }