Return-Path: X-Original-To: apmail-velocity-commits-archive@minotaur.apache.org Delivered-To: apmail-velocity-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D257660CC for ; Wed, 27 Jul 2011 22:26:42 +0000 (UTC) Received: (qmail 44301 invoked by uid 500); 27 Jul 2011 22:26:42 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 44261 invoked by uid 500); 27 Jul 2011 22:26:42 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 44249 invoked by uid 99); 27 Jul 2011 22:26:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 22:26:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 22:26:40 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 747AC2388894 for ; Wed, 27 Jul 2011 22:26:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1151655 - in /velocity/tools/branches/2.0.x: src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java xdocs/changes.xml Date: Wed, 27 Jul 2011 22:26:20 -0000 To: commits@velocity.apache.org From: schultz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110727222620.747AC2388894@eris.apache.org> Author: schultz Date: Wed Jul 27 22:26:19 2011 New Revision: 1151655 URL: http://svn.apache.org/viewvc?rev=1151655&view=rev Log: Added StrutsLinkTool.action and StrutsLinkTool.forward to match new LinkTool API. Modified: velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java velocity/tools/branches/2.0.x/xdocs/changes.xml Modified: velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java?rev=1151655&r1=1151654&r2=1151655&view=diff ============================================================================== --- velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java (original) +++ velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java Wed Jul 27 22:26:19 2011 @@ -80,11 +80,11 @@ public class StrutsLinkTool extends Link StrutsLinkTool sub = null; if ("action".equalsIgnoreCase(this.get)) { - sub = setAction(getme); + sub = action(getme); } else if ("forward".equalsIgnoreCase(this.get)) { - sub = setForward(getme); + sub = forward(getme); } else { @@ -110,7 +110,7 @@ public class StrutsLinkTool extends Link * * @return a new instance of StrutsLinkTool */ - public StrutsLinkTool setAction(String action) + public StrutsLinkTool action(String action) { String url = StrutsUtils.getActionMappingURL(application, request, action); @@ -123,6 +123,21 @@ public class StrutsLinkTool extends Link return (StrutsLinkTool)absolute(url); } + /** + *

Returns a copy of the link with the given action name + * converted into a server-relative URI reference. This method + * does not check if the specified action really is defined. + * This method will overwrite any previous URI reference settings + * but will copy the query string.

+ * + * @param action an action path as defined in struts-config.xml + * + * @return a new instance of StrutsLinkTool + */ + public StrutsLinkTool setAction(String action) + { + return action(action); + } /** *

Returns a copy of the link with the given global or local forward @@ -137,7 +152,7 @@ public class StrutsLinkTool extends Link * * @return a new instance of StrutsLinkTool */ - public StrutsLinkTool setForward(String forward) + public StrutsLinkTool forward(String forward) { String url = StrutsUtils.getForwardURL(request, application, forward); if (url == null) @@ -148,4 +163,22 @@ public class StrutsLinkTool extends Link } return (StrutsLinkTool)absolute(url); } + + /** + *

Returns a copy of the link with the given global or local forward + * name converted into a server-relative URI reference. If the parameter + * does not map to an existing global forward name, null + * is returned. This method will overwrite any previous URI reference + * settings but will copy the query string.

+ * + * @param forward a forward name as defined in struts-config.xml + * in either global-forwards or in the currently executing + * action mapping. + * + * @return a new instance of StrutsLinkTool + */ + public StrutsLinkTool setForward(String forward) + { + return forward(forward); + } } Modified: velocity/tools/branches/2.0.x/xdocs/changes.xml URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.0.x/xdocs/changes.xml?rev=1151655&r1=1151654&r2=1151655&view=diff ============================================================================== --- velocity/tools/branches/2.0.x/xdocs/changes.xml (original) +++ velocity/tools/branches/2.0.x/xdocs/changes.xml Wed Jul 27 22:26:19 2011 @@ -40,6 +40,7 @@
  • fixed VELTOOLS-145 changed StrutsLinkTool's parent class to restore API backward-compatibility (schultz)
  • fixed VELTOOLS-148 - fixed a LinkTool bug with parametersToIgnore management (schultz)
  • fixed VELTOOLS-149 - changed LinkTool.addRequestParams to accept Object[] (schultz)
  • +
  • Added StrutsLinkTool.action and StrutsLinkTool.forward methods as replacements for StrutsLinkTool.setAction ant StrutsLinkTool.setForward to match other new LinkTool methods like LinkTool.relative and LinkTool.absolute (schultz)