struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Huber (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4605) Refactor MessageStoreInterceptor and use PreResultListener to store messages
Date Thu, 24 Mar 2016 08:01:25 GMT

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

Greg Huber edited comment on WW-4605 at 3/24/16 8:01 AM:
---------------------------------------------------------

The interceptor logic has changed, now need to get the isRedirect from the invocation, not
from invocation.getResult() which is null.

isRedirect = ServletRedirectResult.class.getName().equals(resultConfig.getClassName());

The isAssignableFrom wants a class:

The method isAssignableFrom(Class<?>) in the type Class<ServletRedirectResult>
is not applicable for the arguments (String)


######
{code:java}

		Map<String, ResultConfig> results = null;
		ResultConfig resultConfig = null;

		try {

			results = invocation.getProxy().getConfig().getResults();
			resultConfig = results.get(resultCode);

		} catch (NullPointerException e) {
			LOG.debug("Got NPE trying to read result configuration for resultCode [{}]", resultCode);
		}

		boolean isRedirect = false;
		try {
			// isRedirect = invocation.getResult() instanceof ServletRedirectResult;
			isRedirect = ServletRedirectResult.class.getName().equals(resultConfig.getClassName());
		} catch (Exception e) {
			LOG.warn("Cannot read result configuration!", e);
		}
{code}


was (Author: gregh99):
The interceptor logic has changed, now need to get the isRedirect from the invocation, not
from invocation.getResult().

isRedirect = ServletRedirectResult.class.getName().equals(resultConfig.getClassName());

The isAssignableFrom wants a class:

The method isAssignableFrom(Class<?>) in the type Class<ServletRedirectResult>
is not applicable for the arguments (String)


######
{code:java}

		Map<String, ResultConfig> results = null;
		ResultConfig resultConfig = null;

		try {

			results = invocation.getProxy().getConfig().getResults();
			resultConfig = results.get(resultCode);

		} catch (NullPointerException e) {
			LOG.debug("Got NPE trying to read result configuration for resultCode [{}]", resultCode);
		}

		boolean isRedirect = false;
		try {
			// isRedirect = invocation.getResult() instanceof ServletRedirectResult;
			isRedirect = ServletRedirectResult.class.getName().equals(resultConfig.getClassName());
		} catch (Exception e) {
			LOG.warn("Cannot read result configuration!", e);
		}
{code}

> 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
>            Assignee: Lukasz Lenart
>             Fix For: 2.3.28, 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)

Mime
View raw message