I am trying to test controllers that are being protected by a "SecurityInterceptor". Here is my *-servlet.xml configuration:
Now in my test I am going to want to get the bean for the GetServerListController. However, unlike the other beans that are mapped to say '/login.do' where I can just simply call something like this - ctx.getBean("/login.do"); I am not able to do the same given that the path '/getserverlist.do' is not actually a bean id now but rather it is an entry in a Map as a property to the 'secureHandlerMapping' bean.Code:<bean id="secureHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="interceptors"> <list> <ref local="securityInterceptor"/> </list> </property> <property name="urlMap"> <map> <entry key="/getserverlist.do"> <ref local="secure_getserverlist"/> </entry> </map> </property> </bean> <bean id="securityInterceptor" class="presentation.interceptor.authentication.SecurityInterceptor"/> <bean id="secure_getserverlist" class="presentation.controller.GetServerListController"/>
Perhaps the plan is to create a new Url handler mapping class extending AbstractUrlHandlerMapping that not only has setter methods for the urlMap property but also getters. Sound right, another solution? I am all ears right now.


Reply With Quote