In my last post I had explained how I integrated Spring with GWT by using the external library. Now I had another issue, in which I wanted the HttpSession object in the service class. I had to retrieve some variables from the session object. Since I wasn't extending my service layer class from RemoteServiceServlet I couldn't use the methods to get access to the request and response objects and hence I couldn't get the session object. I discovered that I there were some helper classes in the same external library which could be used and injected using Spring AOP. There is a RequestInjection class which was used by us as an interceptor to the request.
It was mapped in the spring-servlet file in the following manner.
< bean id="requestSetter" class="org.gwtwidgets.server.spring.RequestInjection" >
< property name="requestSetterName" value="setRequest"/ >
< property name="responseSetterName" value="setResponse" / >
< / bean >
< bean id="testServiceProxy"
class="org.springframework.aop.framework.ProxyFactoryBean" >
< property name="target" ref="testService" / >
< property name="autodetectInterfaces" value="true" / >
< property name="interceptorNames" >
< list >
< value >requestSetter< / value >
< / list >
< / property >
< / bean >