Menu

#3 MethodInterception AOP does not work

open
None
5
2008-01-21
2007-11-21
Anonymous
No

Hello. I have problem with using spring AOP with beans which extend GWTSpringController. Here is my config:

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop <prop key="/admin/UserService.gwt">userService</prop>
</props>
</property>
</bean>

<bean id="userService"
class="some.client.rpc.UserServiceImpl">
</bean>

UserServiceImpl extends GWTSpringController. The code works fine and there is not problem with execution. The problem starts when i want to use AOP advices. I need this for security (acegi supports URL security and methodInvocation security). I want to use method security.

<bean id="securityAspect"
class="some.aop.SecurityAspect">

</bean>
<aop:config>

<aop:aspect ref="securityAspect">

<aop:pointcut id="theExecutionOfSomeFooServiceMethod"
expression="execution(* some.client.rpc.UserService.*(..))"/>

<aop:around pointcut-ref="theExecutionOfSomeFooServiceMethod"
method="profile"/>

</aop:aspect>
</aop:config>

it does not work. When i use the same aspect in another pointcut ex. execution(* some.client.rpc.AdminService.*(..)) it executes well. My implementation of UserServiceImpl invokes AdminService.

So basically i cannot use aop with beans which extend GWTSpringController. I suspect Reflection is causing problems. Probably AOP does not work with reflection.

I also tried to use org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor which again works for AdminService and not for UserService.

Is it possible to run such thing using GWT-SL ??

Discussion

  • Artur Chyzy

    Artur Chyzy - 2007-11-22

    Logged In: YES
    user_id=1942499
    Originator: NO

    Please check this thread which may be useful http://forum.springframework.org/showthread.php?t=46537

    Is it possible to check for AccessDeniedException to automatically return 403 Forbiddenin response ??

    Are you planning to add some Acegi integration features ??

     
  • Nobody/Anonymous

    Logged In: NO

    Ok it seems somehow it finally worked. Now exception is catched correctly by acegi.
    Probablly my config was wrong but i don;t know exactly what it was.

    Keep on good work...

     
  • George Georgovassilis

    Logged In: YES
    user_id=1105220
    Originator: NO

    Please consider using GWTHandler or even better GWTRPCServiceExporter

     
  • George Georgovassilis

    Logged In: YES
    user_id=1105220
    Originator: NO

    Since in the SL we do only standard stuff like providing controllers and request handler, it should not be a problem to integrate it with Acegi without any changes to the SL.

     
  • George Georgovassilis

    Logged In: YES
    user_id=1105220
    Originator: NO

    Hello Artur

    The nice thing with Acegi, and for this part with Spring/AOP in general is that as a library designer one rarely has to add any features in regard to integration with other libraries - you just wire that functionality via IoC together. If you find any particular problem where the SL inhibits cooperation with Acegi, please tell us so that we can fix it!

     
  • George Georgovassilis

    • assigned_to: nobody --> georgeuoa
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.