I successfully follow GWT and spring4gwt's tutorials and transform the StockWatcher's demo into a Spring(3.0) enabled service , by the following configurations :
web.xml :
<servlet-mapping>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<!-- stockWatcher module is rename-to="stock" -->
<url-pattern>/stock/spring/*</url-pattern>
</servlet-mapping>
StockPriceService.java :
@RemoteServiceRelativePath("spring/stockPriceService")
public interface StockPriceService extends RemoteService
{
StockPrice[] getPrices(String[] symbols) throws DelistedException;
}
spring's app.xml :
<bean id="stockPriceService" class="destiny.gwt.stock.server.StockPriceServiceImpl"/>
Then , I want to add another Service : Chatroom.gwt.xml (rename-to="chatroom") , and hope the two services can be combined in one webapp and served by one spring4gwt instance .
This is my ChatService.java :
@RemoteServiceRelativePath("spring/chatService")
public interface ChatService extends RemoteService
{
public boolean login(String username , String password);
}
spring's app.xml :
<bean id="chatService" class="destiny.gwt.chatroom.server.ChatServiceImpl"/>
<bean id="stockPriceService" class="destiny.gwt.stock.server.StockPriceServiceImpl"/>
As to web.xml :
<servlet-mapping>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<url-pattern>/stock/spring/*</url-pattern>
</servlet-mapping>
Here comes the problem ! I don't know how to write a correct url-pattern to let springGwtRemoteServiceServlet able to simulantously listen to /stock/spring/* and /chatroom/spring/* ?
The StockWatcher module is rename-to="stock" , so each POST request will be post to URI "/stock/..." . And Chatroom module is rename-to="chatroom" , and each POST will be post to URI "/chatroom/..." . I tried to write /*/spring/*
, but in vain , both not work...