GWT Stack Integration Lab 3

GWT RPC With the Java Stack

Add the stack-gwt-spring Dependency

  1. Open the file "/StackGWT-web/pom.xml".
  2. Add to the dependencies section of the pom the following:

Add the GWT RPC Dispatcher Servlet to web.xml

  1. Open the file "/StackGWT-web/src/main/webapp/WEB-INF/web.xml".
  2. In the Servlets section of the web.xml (around line 78) add the following:

This adds the GWT RPC Dispatcher Servlet to your application and maps it to *.gwtrpc. This means that any web request that has a URI ending in *.gwtrpc will be handling by the GWT RPC mechanism.

Add the GWT RPC Spring context file

  1. Right click on the folder /StackGWT-web/src/main/webapp/WEB-INF and select New | File.
  2. Give the file the name "gwtrpc-servlet.xml".
  3. Select Finish.
  4. Paste into the file the following:
<?xml version="1.0" encoding="UTF-8"?>
<!-- =========================================================== -->
<!-- GWT RPC Configuration File					             -->
<!-- =========================================================== -->
<beans xmlns=""

	<context:component-scan base-package="" use-default-filters="false">
		<context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/>

	<gwt:gwt-rpc-dispatcher />


You're probably thinking to yourself, this is a lot of boilerplate. You're right. Yes, we will be adding this to Stack Starter in the near future so hopefully you'll never have to do all of this again. Sorry for the inconvenience.

Create an RPC Service

  1. Create a RemoteService interface. Remember this must go in the package . When annotating this interface with @RemoteInterfaceRelativePath be sure the value ends with .gwtrpc.
  2. Create its corresponding Async interface.
  3. Implement the RemoteService in the package.
  4. Annotate the implementation with @org.springframework.stereotype.Controller.
  5. Instantiate your async interface using GWT deferred binding. GWT deferred binding is the GWT.create(...) stuff.
  6. Add a call to the remote service in your entry point.
  7. Restart Tomcat. If you're not sure how to do this, ask an experienced Stack developer sitting close to you.
  8. Test the call to your remote service

You may want to refer back to Lab 1 when doing this part of the lab.

This page was last modified on 10 June 2010, at 12:06.

Note: Content found in this wiki may not always reflect official Church information. See Terms of Use.