Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB9A610CE6 for ; Thu, 18 Jul 2013 13:34:49 +0000 (UTC) Received: (qmail 69056 invoked by uid 500); 18 Jul 2013 13:34:49 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 69023 invoked by uid 500); 18 Jul 2013 13:34:49 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 68603 invoked by uid 99); 18 Jul 2013 13:34:48 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 13:34:48 +0000 Date: Thu, 18 Jul 2013 13:34:48 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-4144) Have ObjectFactory buildResult obey ParameterNameAware restrictions for a Result MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13712325#comment-13712325 ] Lukasz Lenart commented on WW-4144: ----------------------------------- You use exactly the same {{ParameterNameAware}} interface as for actions? What do you do if Result doesn't implement {{ParameterNameAware}}? And do you use that? Wrap each predefined Result with your custom implementation? > Have ObjectFactory buildResult obey ParameterNameAware restrictions for a Result > -------------------------------------------------------------------------------- > > Key: WW-4144 > URL: https://issues.apache.org/jira/browse/WW-4144 > Project: Struts 2 > Issue Type: Improvement > Components: Core Actions > Affects Versions: 2.3.15.1 > Reporter: Jasper Rosenberg > Priority: Minor > Labels: ObjectFactory > Fix For: 2.3.16 > > > com.opensymphony.xwork2.ObjectFactory#buildResult(ResultConfig, Map), injects all of the resultConfig parameters into the result after it has been built. > However, I'd like to be able to have my Result implement ParameterNameAware, and then have buildResult obey its acceptableParameterName() result so I can filter out what parameters can be injected. > I'm sorry I don't have a proper patch, but it is a very small change. Only call setProperty on the result if it is not ParameterNameAware, or it is and the parameter name is acceptable. > {code:java} > if ((!(result instanceof ParameterNameAware)) || (((ParameterNameAware) result).acceptableParameterName(paramEntry.getKey()))) { > reflectionProvider.setProperty(paramEntry.getKey(), paramEntry.getValue(), result, extraContext, true); > } > {code} > I have been running a Struts 2 app for 6 years with this change in place. Just getting around to suggesting it as a patch :) > It does also look like the documentation for ParameterNameAware would need to be updated to reflect that it can also be used for results, not just actions. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira