Java Reference
In-Depth Information
Listing 9-7. profile.xml
<?xml version="1.0"?>
<wagent-profile>Wave_Apress</wagent-profile>
Listing 9-8. web.xml
<servlet>
<servlet-name>Wave_ApressServlet</servlet-name>
<servlet-class>com.kyleroche.wave.Wave_ApressServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Profile</servlet-name>
<servlet-
class>com.kyleroche.wave.Wave_ApressProfile</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Profile</servlet-name>
<url-pattern>/_wave/robot/profile</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Wave_ApressServlet</servlet-name>
<url-pattern>/_wave/robot/jsonrpc</url-pattern>
</servlet-mapping>
Try things out with Wave and see how your robot responds. Start a new wave. Click the New Wave
button at the top of your Inbox. Click the plus sign (+) next to your profile picture at the top of your
new wave. Add application@appspot.com to the wave, where “ application” is the application
ID of your Google App Engine project. Once the robot has been added to the conversation it will
respond with the welcome message from Wave_ApressServlet.java . This response comes
after you check the .wasSelfAdded() method of the event bundle that you were sent from Wave.
Google Wave will send your application a bundle of “events” every time something has happened in
the wave. Among dozens of other actions, events include adding participants, changing text, adding
images or elements to the wave, and removing participants.
Now when the robot finds the text string “Apress” in the conversation, it will respond with
“How's the topic?” This is a simple example, but keep in mind that you could have easily called
out to another system, enriching the conversation with relevant data from your financial system,
or your CRM database. See Figure 9-11, which demonstrates both responses from your robot.
 
Search WWH ::




Custom Search