velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r536295 - in /velocity/tools/trunk: src/java/org/apache/velocity/tools/struts/StrutsUtils.java xdocs/changes.xml
Date Tue, 08 May 2007 18:44:44 GMT
Author: nbubna
Date: Tue May  8 11:44:43 2007
New Revision: 536295

URL: http://svn.apache.org/viewvc?view=rev&rev=536295
Log:
have setForward() lookup local forwards, not just global ones (VELTOOLS-82), thanks to Christopher
Schulz for this patch

Modified:
    velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsUtils.java
    velocity/tools/trunk/xdocs/changes.xml

Modified: velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsUtils.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsUtils.java?view=diff&rev=536295&r1=536294&r2=536295
==============================================================================
--- velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsUtils.java (original)
+++ velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsUtils.java Tue May
 8 11:44:43 2007
@@ -404,10 +404,28 @@
     {
         ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);
         //TODO? beware of null module config if ActionServlet isn't init'ed?
-        ForwardConfig fc = moduleConfig.findForwardConfig(forward);
-        if (fc == null)
+
+        ActionConfig actionConfig =
+            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);
+
+        // NOTE: ActionConfig.findForwardConfig only searches local forwards
+        ForwardConfig fc = null;
+        if(actionConfig != null)
         {
-            return null;
+            fc = actionConfig.findForwardConfig(forward);
+
+            // No ActionConfig forward?
+            // Find the ForwardConfig in the global-forwards.
+            if(fc == null)
+            {
+                fc = moduleConfig.findForwardConfig(forward);
+
+                // ok, give up
+                if (fc == null)
+                {
+                    return null;
+                }
+            }
         }
 
         StringBuffer url = new StringBuffer();

Modified: velocity/tools/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/xdocs/changes.xml?view=diff&rev=536295&r1=536294&r2=536295
==============================================================================
--- velocity/tools/trunk/xdocs/changes.xml (original)
+++ velocity/tools/trunk/xdocs/changes.xml Tue May  8 11:44:43 2007
@@ -32,6 +32,7 @@
     <subsection name="1.4-dev">
         <p>This section describes changes after the 1.3 release.</p>
         <ul>
+        <li>Changed StrutsLinkTool.setForward() to look for forwards local to the action
mapping, before looking up global forwards. Thanks to Christopher Schultz. (ndb)</li>
         <li>Added propertyKey() and propertyValue() escaping support to EscapeTool
(VELTOOLS-81). Thanks to Phil Cornelius for this patch. (ndb)</li>
         <li>Fixed bug in request-path restriction when using wildcards. (ndb)</li>
         <li>Make default locale and format for NumberTool configurable, just as they
are in DateTool. (ndb)</li>



Mime
View raw message