You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Nicolas Raynaud (JIRA)" <ji...@apache.org> on 2008/11/15 17:41:40 UTC

[jira] Created: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

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.


[jira] Commented: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Nicolas Raynaud (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44956#action_44956 ] 

Nicolas Raynaud commented on WW-2871:
-------------------------------------

Ok, I will check as soon as possible. To be clear, I made a mistake on the issue version field, I was actually using an older one.

For now I have to convert my project, it seems, I will report after that.

> 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.


[jira] Issue Comment Edited: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Nicolas Raynaud (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44954#action_44954 ] 

nraynaud edited comment on WW-2871 at 11/15/08 10:36 AM:
----------------------------------------------------------------

yes, sorry I started my project more than 1 year ago.

edit :
I don't find how I can delete or close this issue, any help please ?

      was (Author: nraynaud):
    yes, sorry I started my project more than 1 year ago.
  
> 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.


[jira] Commented: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44957#action_44957 ] 

Dave Newton commented on WW-2871:
---------------------------------

Oh, okay. In that case don't worry about it; this issue was definitely resolved in XWork.

Thanks,
Dave


> 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.


[jira] Resolved: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Commented: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Nicolas Raynaud (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44954#action_44954 ] 

Nicolas Raynaud commented on WW-2871:
-------------------------------------

yes, sorry I started my project more than 1 year ago.

> 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.


[jira] Commented: (WW-2871) avoid fetching twice the model in ModelDrivenInterceptor

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44953#action_44953 ] 

Dave Newton commented on WW-2871:
---------------------------------

What version of XWork are you looking at? AFAIK the XWork code hasn't done two getModel()s since like a year ago. The current code looks like this:

        if (action instanceof ModelDriven) {
            ModelDriven modelDriven = (ModelDriven) action;
            ValueStack stack = invocation.getStack();
            Object model = modelDriven.getModel();
            if (model !=  null) {
            	stack.push(model);
            }
            if (refreshModelBeforeResult) {
                invocation.addPreResultListener(new RefreshModelBeforeResult(modelDriven, model));
            }
        }


> 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.