[ 
https://issues.apache.org/jira/browse/WW-4605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147445#comment-15147445
 ] 

Greg Huber commented on WW-4605:
--------------------------------

Is it necessary to move the position of the 

result = createResult();   in DefaultActionInvocation

as it stops my Interceptor from working.  I am modifying the result code in a 
PreResultListener() interceptor and need the result to be created after 
applying the interceptor otherwise I have the wrong value.

{java:code}
......
public String intercept(ActionInvocation invocation) throws Exception {

                if (applyInterceptor(invocation)) {

                        invocation.addPreResultListener(new PreResultListener() 
{
                                public void beforeResult(ActionInvocation 
invocation,
                                                String resultCode) {

                                        final ActionContext context = invocation
                                                        .getInvocationContext();

                                        final HttpServletRequest request = 
(HttpServletRequest) context
                                                        
.get(StrutsStatics.HTTP_REQUEST);

                                        if (DeviceStore.isMobileDevice(request, 
true)
                                                        && 
applyResult(resultCode)) {

                                                
invocation.setResultCode(resultCode + "-"
                                                                + Type.mobile);

                                                Object action = 
invocation.getAction();

                                                if (action instanceof UIAction) 
{

                                                        UIAction theAction = 
(UIAction) action;
                                                        
theAction.setMobileAwareResult(true);

                                                }
                                        }

                                }
                        });

                }

                return doIntercept(invocation);
        }
....
{code}

My interceptor appends to the result the device type, so is its a mobile I get 
list-mobile

<result name="list" type="tiles">.MyView</result>
<result name="list-mobile" type="tiles">.MyView-mobile</result>

Calling it where it currently is all I get is list even though I am setting the 
ResultCode using the above.



> Refactor MessageStoreInterceptor and use PreResultListener to store messages
> ----------------------------------------------------------------------------
>
>                 Key: WW-4605
>                 URL: https://issues.apache.org/jira/browse/WW-4605
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.3.24
>            Reporter: Lukasz Lenart
>             Fix For: 2.3.25, 2.5
>
>
> See WW-4600 as this issue is similar, when response was already comitted 
> (redirect was send, JSP was rendered), logic in {{after}} method won't work 
> as it isn't possible to modify session when response was comitted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to