PDA

View Full Version : MVC/AOP question


syncro
May 6th, 2008, 04:05 PM
Hi all!

I have a SecurityInterceptor class which takes a request, response and a session to decide where to redirect the user (via response.sendRedirect). The problem is that when I redirect the user the target method in my aop configuration is still run. For instance, if a user isn't allowed to see /index.html and my interceptor redirects the user to /login.html the mapped method against /index.html will still run.

Here's my AOP configuration

<aop:config>
<aop:aspect id="securityAspect" ref="securityInterceptor">
<aop:pointcut id="securityPointCut" expression="execution(* net.myapp.web..*prepare*(..)) and args(request, response, session,..)"/>
<aop:before pointcut-ref="securityPointCut" method="intercept" />
</aop:aspect>
</aop:config>


Any pointers on how I can get target methods not to run if the interceptor redirects the user to a different URL?

Thanks!

syncro
May 7th, 2008, 04:36 AM
changed my advice type from

<aop:before pointcut-ref="securityPointCut" method="intercept" />

to

<aop:around pointcut-ref="securityPointCut" method="intercept" />

and now it's working!