Announcement Announcement Module
Collapse
No announcement yet.
MVC/AOP question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MVC/AOP question

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

  • #2
    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!

    Comment

    Working...
    X