|
Project Information
Featured
Downloads
Links
|
The gwtrpc-spring jar allows for simple integration of Spring and GWT 1.6. Instead of having a separate servlet for each service there is one RemoteServiceServlet that looks the configured SpringContext for a instance of a class that implements the Remote Service. So that means your services don't have to inherit RemoteServiceServlet just implement your RemoteService interface. That means any Spring POJO can become a Gwt RPC Service. To set it up:
2. Add the spring jars to to your /war/WEB-INF/lib directory (i.e. spring-core.jar, spring-beans.jar, spring-context.jar and spring-web.jar) 3. Edit your web.xml to add the dispatcher servlet<servlet> <servlet-name>dispatcher</servlet-name> <servlet-class> org.gwtrpcspring.RemoteServiceDispatcher </servlet-class> </servlet>4. Edit the web.xml to add the Context Listener<listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener>5. Edit the web.xml to add servlet-mappings for the services to the dispatcher<servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/myapp/greet</url-pattern> </servlet-mapping>6. Create an applicationContext.xml with your services defined.<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="greetService" class="org.gwtrpcspring.example.server.GreetingServiceImpl"> </bean> </beans> That's all it takes. |