HelloWorld RPC Service

package org.mortbay.gwt.example.client;

import com.google.gwt.user.client.rpc.RemoteService;

public interface HelloWorldService extends RemoteService
{

    public String sayHello(String sender);

}
package org.mortbay.gwt.example.client;

import com.google.gwt.user.client.rpc.RemoteService;

public interface HelloWorldService extends RemoteService
{

    public String sayHello(String sender);

}
package org.mortbay.gwt.example.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface HelloWorldServiceAsync
{

    public void sayHello(String sender, AsyncCallback callback);

}

Using Continuations (RetryRequest) | jetty6

package org.mortbay.gwt.example.server;

import javax.servlet.http.HttpServletRequest;

import org.mortbay.gwt.AsyncRemoteServiceServlet;
import org.mortbay.gwt.example.client.HelloWorldService;
import org.mortbay.util.ajax.Continuation;
import org.mortbay.util.ajax.ContinuationSupport;

public class HelloWorldServiceImpl extends AsyncRemoteServiceServlet implements HelloWorldService
{

    private static final long serialVersionUID = 1L;

    public String sayHello(String sender)
    {
        HttpServletRequest request = getThreadLocalRequest();
        Continuation continuation = ContinuationSupport.getContinuation(request, null);
        if(continuation.isNew() || !continuation.isPending())
        {
            request.setAttribute("ts", Long.valueOf(System.currentTimeMillis()));
            continuation.suspend(5000);
        }
        long elapsed = System.currentTimeMillis() - ((Long)request.getAttribute("ts")).longValue();
        return "Hello world *" + sender + "* resumed after " + elapsed + " ms";
    }

}

Using Servlet-3.0 suspend/resume api | jetty7

package org.mortbay.gwt.example.server;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mortbay.gwt.AsyncRemoteServiceServlet;
import org.mortbay.gwt.example.client.HelloWorldService;

public class HelloWorldServiceImpl extends AsyncRemoteServiceServlet implements HelloWorldService
{

    private static final long serialVersionUID = 1L;

    public String sayHello(String sender)
    {

        HttpServletRequest request = getThreadLocalRequest();
        HttpServletResponse response = getThreadLocalResponse();
        System.err.println("HANDLING: " + request + " | " + request.hashCode() + " | " + response.hashCode());

        if(request.isInitial())
        {
            request.setAttribute("ts", Long.valueOf(System.currentTimeMillis()));
            request.suspend(5000);
            return null;
        }
        // timed-out or resumed
        System.err.println("RESPONDING");
        long elapsed = System.currentTimeMillis() - ((Long)request.getAttribute("ts")).longValue();
        return "Hello world *" + sender + "* resumed after " + elapsed + " ms";
    }

}