Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 11464 invoked from network); 13 Dec 2007 22:59:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Dec 2007 22:59:47 -0000 Received: (qmail 9961 invoked by uid 500); 13 Dec 2007 22:59:34 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 9834 invoked by uid 500); 13 Dec 2007 22:59:34 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 9823 invoked by uid 99); 13 Dec 2007 22:59:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2007 14:59:34 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [216.227.215.170] (HELO chiron.lunarpages.com) (216.227.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2007 22:59:32 +0000 Received: from [71.230.43.254] (helo=[192.168.123.5]) by chiron.lunarpages.com with esmtpa (Exim 4.68) (envelope-from ) id 1J2x1A-0001zi-OM for dev@struts.apache.org; Thu, 13 Dec 2007 14:59:01 -0800 Message-ID: <4761B935.8020305@omnytex.com> Date: Thu, 13 Dec 2007 17:59:01 -0500 From: "Frank W. Zammetti" User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Struts Developers List Subject: Re: Result types for S1 References: <4760CD4A.70107@omnytex.com> <47617D37.108@omnytex.com> <4761842B.5030107@omnytex.com> <4761934A.6010002@omnytex.com> <47619DB1.4050304@omnytex.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - chiron.lunarpages.com X-AntiAbuse: Original Domain - struts.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - omnytex.com X-Virus-Checked: Checked by ClamAV on apache.org Paul Benedict wrote: > I said new method, I didn't say replace the previous method :-) I wouldn't > implement anything that didn't allow current Struts actions to work. It's > all blue sky thinking so there's a lot you can help me figure out. No, I knew you wouldn't do that... although it wasn't initially clear to me how it would still be compatible, I had no doubt that was just my lack of understanding and you had that answer :) So, let me think this through out loud, make sure I'm on the same page as you... I'm a Struts developer, and I upgrade to 1.4 where all this stuff presumably is. Ok, so none of my existing code breaks, good to go there. But, I want to use this new JSON capability, and let's think simplest case: I just want to render my ActionForm as JSON and return it, no options to fiddle with or anything like that. So, I need to implement this new version of execute(). Not too big a deal. I'm OK with it so far. But what if I want to take an existing Action and do this? Still not a big deal I think: implement the new version of execute(), call the existing execute(), ignore the returned ActionForward and do whatever I need to do to get the JSON output to happen. Not a big deal. I don't care about the ThreadLocal stuff, or the alternate execute() version, unless I want to. The only objection that comes to mind for me is that maybe having two different types of execute() methods is a bit more confusing than it needs to be. I don't think it's the kind of thing you can deprecate over time, there's too big an installed base to do that with. My puny brain needs simplicity :) So, I'm wondering if there's not a simpler answer, which is my roundabout way of asking: what do you think of my suggested approach to this? Just to recap: >> Another way to do it might be to subclass ActionForward, calling it >> Result. Then, after the Action executes, we try to cast the result to >> Result, and if we catch a ClassCastException, then we have a plain old >> ActionForward and we process it same as always, but if the exception >> didn't occur then we have a Result and we can go off and do "result >> things(tm)". Because to me, while what you propose isn't exactly rocket science to implement or make use of, I think this approach is simpler still, and requires very minimal changes to the codebase, also something I strive for (not just with Struts either) ...or did you have some other motivation for those changes besides this? Did you have other plans that hinge on these changes? Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: fzammetti@hotmail.com Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For additional commands, e-mail: dev-help@struts.apache.org