You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Torben Hedstrøm <to...@gmail.com> on 2011/11/24 14:09:24 UTC
Interceptor result control
Hi...
How do I control the result from within my Interceptors ?.
-I have defined :
<interceptors>
<interceptor name="exceptionhandler"
class="org.husejerforeningen.interceptor.ExceptionInterceptor"/>
<interceptor-stack name="hf-default">
<interceptor-ref name="exceptionhandler" />
<interceptor-ref name="params" />
<interceptor-ref name="servletConfig"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="hf-default"/>
<global-results>
<result name="error">/err.jsp</result>
</global-results>
So to test things...
public class ExceptionInterceptor implements Interceptor {
...
public String intercept(ActionInvocation ai) throws Exception {
...
ai.invoke();
return "error";
}
...
}
But my application does not go to the result defined by the "error"
outcome. Am I missing the point here ??.
--
Med venlig hilsen / Kind regards
Torben Hedstrøm
Re: Interceptor result control
Posted by Dave Newton <da...@gmail.com>.
Yep!
The result has already been rendered by the time `invoke()` returns. [1]
Dave
[1] http://struts.apache.org/2.x/docs/writing-interceptors.html
2011/11/24 Torben Hedstrøm <to...@gmail.com>
> Hi...
>
> How do I control the result from within my Interceptors ?.
>
> -I have defined :
>
>
> <interceptors>
> <interceptor name="exceptionhandler"
> class="org.husejerforeningen.interceptor.ExceptionInterceptor"/>
> <interceptor-stack name="hf-default">
> <interceptor-ref name="exceptionhandler" />
> <interceptor-ref name="params" />
> <interceptor-ref name="servletConfig"/>
> </interceptor-stack>
> </interceptors>
> <default-interceptor-ref name="hf-default"/>
>
> <global-results>
> <result name="error">/err.jsp</result>
> </global-results>
>
>
>
> So to test things...
>
>
> public class ExceptionInterceptor implements Interceptor {
> ...
> public String intercept(ActionInvocation ai) throws Exception {
> ...
> ai.invoke();
> return "error";
> }
> ...
> }
>
>
> But my application does not go to the result defined by the "error"
> outcome. Am I missing the point here ??.
>
>
> --
> Med venlig hilsen / Kind regards
>
> Torben Hedstrøm
>