struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Newton (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor
Date Sat, 15 Nov 2008 18:49:38 GMT

     [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dave Newton resolved WW-2871.
-----------------------------

    Resolution: Not A Problem

No problem, although if you're using S2.1 this shouldn't be an issue anymore. If possible,
could you verify that you're really seeing this behavior? Thanks.

Resolved as per reporter comment.

> avoid fetching twice the model in ModelDrivenInterceptor 
> ---------------------------------------------------------
>
>                 Key: WW-2871
>                 URL: https://issues.apache.org/struts/browse/WW-2871
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.1.2
>            Reporter: Nicolas Raynaud
>            Priority: Minor
>
> the ModelDrivenInterceptor fetche twice the model by default, this is really anoying
when we back the getModel on a database action.
> here is the code I propose :
> public class ModelDrivenInterceptor extends AbstractInterceptor {
>     public String intercept(final ActionInvocation invocation) throws Exception {
>         final Object action = invocation.getAction();
>         if (action instanceof ModelDriven) {
>             final ModelDriven<?> modelDriven = (ModelDriven<?>) action;
>             //avoid fetching the model twice.
>             final Object model = modelDriven.getModel();
>             if (model != null)
>                 invocation.getStack().push(model);
>         }
>         return invocation.invoke();
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message