此内容没有您所选择的语言版本。
25.2. Preparing your component
To prepare a Seam component to be called with GWT, you must first create both synchronous and asynchronous service interfaces for the methods you wish to call. Both interfaces should extend the GWT interface
com.google.gwt.user.client.rpc.RemoteService
:
public interface MyService extends RemoteService { public String askIt(String question); }
public interface MyService extends RemoteService {
public String askIt(String question);
}
The asynchronous interface should be identical, except for an additional
AsyncCallback
parameter for each of the methods it declares:
public interface MyServiceAsync extends RemoteService { public void askIt(String question, AsyncCallback callback); }
public interface MyServiceAsync extends RemoteService {
public void askIt(String question, AsyncCallback callback);
}
The asynchronous interface (in this case,
MyServiceAsync
) is implemented by GWT, and should never be implemented directly.
The next step is to create a Seam component that implements the synchronous interface:
The Seam component's name must match the fully-qualified name of the GWT client interface (as shown), or the Seam Resource Servlet will not be able to find it when a client makes a GWT call. Methods that GWT will make accessible must be annotated with
@WebRemote
.