Ben Biddington

Whatever it is, it's not about "coding"

Posts Tagged ‘google

Creating a wave robot

leave a comment »

Download Eclipse Java EE IDE, and follow the instructions for getting all of the AppEngine plugins. It’s important to get these because it simplifies the deployment process to single click.

  1. Create a new web application project.
  2. Download all of the Wave Robot Java Client Library jars from here.
    1. Copy them to your /war/WEB-INF/lib directory.
    2. Reference them (Alt + Enter > Java Build Path > Libraries > Add JARS…).
      If successful, they’ll appear in a Referenced Libraries node in Package Explorer.

Edit web.xml

Add an endpoint for Wave to post to:


We now have a handler for incoming wave requests. All wave requests will be routed to SearchServlet.

Add capabilities.xml

Registers servlets for wave events, add one to your /war/_wave directory:

<?xml version="1.0" encoding="utf-8"?>
<w:robot xmlns:w="">
    <w:capability name="WAVELET_PARTICIPANTS_CHANGED" content="true" />
    <w:capability name="BLIP_SUBMITTED" content="true" />

Implementing a robot servlet

Very easy, derive from, which has a single method:


public class SearchServlet extends AbstractRobotServlet {
    public void processEvents(RobotMessageBundle bundle) { }

There are numerous tutorials around describing what to do next.

Setting robot profile image

This amounts to adding the root /_wave/robot/profile endpoint. There easiest way to do this is to derive a servlet from, and override any of the methods you choose.

To set the avatar image, override getRobotAvatarUrl:

public class Profile extends ProfileServlet {
    public String getRobotAvatarUrl() {
        return ";

And then place your image your /war/_wave directory. There are other useful settings like display name which can also be provided by override. The default content type of ProfileServlet-derive types is application/json.

Don’t forget to register the new servlet by updating web.xml.


Very simple, it’s all done by the IDE.



Written by benbiddington

18 October, 2009 at 10:53