struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Huber (JIRA)" <>
Subject [jira] [Commented] (WW-4605) Refactor MessageStoreInterceptor and use PreResultListener to store messages
Date Mon, 15 Feb 2016 15:01:18 GMT


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.

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

					final HttpServletRequest request = (HttpServletRequest) context

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

						invocation.setResultCode(resultCode + "-"

						Object action = invocation.getAction();

						if (action instanceof UIAction) {

							UIAction theAction = (UIAction) action;




		return doIntercept(invocation);

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

View raw message