Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 86321 invoked from network); 24 Aug 2007 15:01:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Aug 2007 15:01:28 -0000 Received: (qmail 73136 invoked by uid 500); 24 Aug 2007 15:01:17 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 72179 invoked by uid 500); 24 Aug 2007 15:01:15 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 72168 invoked by uid 99); 24 Aug 2007 15:01:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2007 08:01:15 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [200.7.97.158] (HELO mail.sitec.com.ve) (200.7.97.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2007 15:01:52 +0000 Received: from nboscan ([200.8.97.36] RDNS failed) by mail.sitec.com.ve with Microsoft SMTPSVC(6.0.3790.1830); Fri, 24 Aug 2007 11:02:08 -0400 From: =?iso-8859-1?Q?N=E9stor_Bosc=E1n?= To: Subject: Struts 2 and DWR Date: Fri, 24 Aug 2007 10:59:19 -0400 Message-ID: <007401c7e65f$5db1bf40$0300a8c0@tcs.com.ve> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0075_01C7E63D.D6A01F40" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Thread-Index: AcfmX0F+1dxnXPBnSC2N8T2J2gm9QQAAA0eQ X-OriginalArrivalTime: 24 Aug 2007 15:02:09.0062 (UTC) FILETIME=[BE32A460:01C7E65F] X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_0075_01C7E63D.D6A01F40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=20 =20 I created a code based on the WebWork code that can invoke a Struts 2 = Action from DWR. You can invoke it just like the WebWork version and you can = use DWRActionUtil.js. It does not do everything that the WebWorks code does, = it invokes de Action method and returns the Action object. Hope somebody = finds it useful. =20 public class DWRAction { private static final Logger log =3D Logger.getLogger = (DWRAction.class); =20 public static Object execute (ActionDefinition actionDefinition, Map params, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { ActionMapping mapping; Dispatcher dispatcher; Map context; ActionProxy proxy; =20 try { dispatcher =3D Dispatcher.getInstance (); mapping =3D new ActionMapping (actionDefinition.getAction(), actionDefinition.getNamespace(), actionDefinition.getMethod(), params); context =3D dispatcher.createContextMap (request, response, = mapping, servletContext); =20 proxy =3D ((ActionProxyFactory) dispatcher.getContainer ().getInstance (ActionProxyFactory.class)).createActionProxy (actionDefinition.getNamespace (), actionDefinition.getAction (), = context, false, false); proxy.setMethod (actionDefinition.getMethod ()); proxy.execute (); =20 return (proxy.getAction ()); } catch (Exception e) { log.error ("Cannot invoke action '" + actionDefinition.getAction() = + "' in namespace '" + actionDefinition.getNamespace() + "'", e); throw e; } } } =20 Regards, =20 N=E9stor Bosc=E1n ------=_NextPart_000_0075_01C7E63D.D6A01F40--