[ http://mc4j.org/jira/browse/STS-223?page=comments#action_10378 ] 

Tim Fennell commented on STS-223:
---------------------------------

Hey Brian: I've just tried to replicate this using both the 1.3.2 release 
version of Stripes and the 1.4 code base.  In both places it works just fine.

Are you sure that your interceptor is actually being fired?  You know you need 
to add something like this to your web.xml right?

        <init-param>
            <param-name>Interceptor.Classes</param-name>
            
<param-value>com.myco.MyInterceptor,net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor</param-value>
        </init-param>




> Returned Resolution in Interceptors has no effect
> -------------------------------------------------
>
>          Key: STS-223
>          URL: http://mc4j.org/jira/browse/STS-223
>      Project: Stripes
>         Type: Bug

>   Components: ActionBean Dispatching
>     Versions: Release 1.3.2
>     Reporter: Brian Nørremark
>     Assignee: Tim Fennell

>
> A very boiled down Interceptor:
> public class MyInterceptor implements Interceptor {
>   public Resolution intercept(ExecutionContext context) throws Exception {
>     Resolution proceed = context.proceed();
>     
>     return new RedirectResolution("/index.jsp");
>   }
> }
> I expected this redirects me to index.jsp, however the proceed-Resolution 
> overrides this.
> Also - the documentation needs a little work on the Security-example. I 
> propose the following example instead:
> @Intercepts(LifecycleStage.HandlerResolution)
> public class SecurityInterceptor implements Interceptor {
>     /** Intercepts execution and checks that the user has appropriate 
> permissions. */
>     public Resolution intercept(ExecutionContext ctx) throws Exception {
>         if (isPermitted(ctx.getActionBean(), ctx.getActionBeanContext()) {
>             return context.proceed();
>         } else if (loggedIn(ctx.getActionBeanContext()) {
>             return new RedirectResolution("/security/Unauthorized.jsp");
>         } else {
>             return new RedirectResolution("/security/Login.jsp");
>         }
>     }
>     /** Returns true if the user is logged in. */
>     protected boolean isLoggedIn(ActionBeanContext ctx) { 
>         return ((MyActionBeanContext) ctx).getUser() != null;
>     }
>     /** Returns true if the user is permitted to invoke the event requested. 
> */
>     protected boolean isPermitted() { ... }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to