Hello Miguel, I would like for you to review the attached demo for GWT that demonstrates the use of GWT RPC in the context of a gadget built with gwt-gadgets.
A samples/gadgetrpc A samples/gadgetrpc/launch-scripts A samples/gadgetrpc/launch-scripts/linux A samples/gadgetrpc/launch-scripts/linux/GadgetRPC-shell A samples/gadgetrpc/launch-scripts/linux/GadgetRPC-compile A samples/gadgetrpc/launch-scripts/mac A samples/gadgetrpc/launch-scripts/mac/GadgetRPC-shell A samples/gadgetrpc/launch-scripts/mac/GadgetRPC-compile A samples/gadgetrpc/launch-scripts/windows A samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd A samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd A samples/gadgetrpc/src A samples/gadgetrpc/src/com A samples/gadgetrpc/src/com/google A samples/gadgetrpc/src/com/google/gwt A samples/gadgetrpc/src/com/google/gwt/gadgets A samples/gadgetrpc/src/com/google/gwt/gadgets/sample A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html A samples/gadgetrpc/build.xml ? eclipse/samples/gadgetrpc/bin A eclipse/samples/gadgetrpc A eclipse/samples/gadgetrpc/.classpath A eclipse/samples/gadgetrpc/.project A eclipse/samples/gadgetrpc/.checkstyle M samples/build.xml -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
A samples/gadgetrpc A samples/gadgetrpc/launch-scripts A samples/gadgetrpc/launch-scripts/linux A samples/gadgetrpc/launch-scripts/linux/GadgetRPC-shell A samples/gadgetrpc/launch-scripts/linux/GadgetRPC-compile A samples/gadgetrpc/launch-scripts/mac A samples/gadgetrpc/launch-scripts/mac/GadgetRPC-shell A samples/gadgetrpc/launch-scripts/mac/GadgetRPC-compile A samples/gadgetrpc/launch-scripts/windows A samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd A samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd A samples/gadgetrpc/src A samples/gadgetrpc/src/com A samples/gadgetrpc/src/com/google A samples/gadgetrpc/src/com/google/gwt A samples/gadgetrpc/src/com/google/gwt/gadgets A samples/gadgetrpc/src/com/google/gwt/gadgets/sample A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public A samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html A samples/gadgetrpc/build.xml ? eclipse/samples/gadgetrpc/bin A eclipse/samples/gadgetrpc A eclipse/samples/gadgetrpc/.classpath A eclipse/samples/gadgetrpc/.project A eclipse/samples/gadgetrpc/.checkstyle M samples/build.xml Index: samples/gadgetrpc/launch-scripts/linux/GadgetRPC-shell =================================================================== --- samples/gadgetrpc/launch-scripts/linux/GadgetRPC-shell (revision 0) +++ samples/gadgetrpc/launch-scripts/linux/GadgetRPC-shell (revision 0) @@ -0,0 +1,8 @@ +#!/bin/sh +APPDIR=../..; +if [ "$GWT_HOME" == "" ]; then + echo "The environment variable GWT_HOME is not defined, it should point to a valid GWT installation." + exit +fi + +java -cp "$APPDIR/src:$APPDIR/bin:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-linux.jar:../../../../gwt-gadgets.jar" com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@"; Index: samples/gadgetrpc/launch-scripts/linux/GadgetRPC-compile =================================================================== --- samples/gadgetrpc/launch-scripts/linux/GadgetRPC-compile (revision 0) +++ samples/gadgetrpc/launch-scripts/linux/GadgetRPC-compile (revision 0) @@ -0,0 +1,8 @@ +#!/bin/sh +APPDIR=../..; +if [ "$GWT_HOME" == "" ]; then + echo "The environment variable GWT_HOME is not defined, it should point to a valid GWT installation." + exit +fi + +java -cp "$APPDIR/src:$APPDIR/bin:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-linux.jar:../../../../gwt-gadgets.jar" com.google.gwt.dev.GWTCompiler -out "$APPDIR/www" "$@" com.google.gwt.gadgets.sample.gadgetRPC.GadgetRPC; Index: samples/gadgetrpc/launch-scripts/mac/GadgetRPC-shell =================================================================== --- samples/gadgetrpc/launch-scripts/mac/GadgetRPC-shell (revision 0) +++ samples/gadgetrpc/launch-scripts/mac/GadgetRPC-shell (revision 0) @@ -0,0 +1,8 @@ +#!/bin/sh +APPDIR=../..; +if [ "$GWT_HOME" == "" ]; then + echo "The environment variable GWT_HOME is not defined, it should point to a valid GWT installation." + exit +fi + +java -XstartOnFirstThread -cp "$APPDIR/src:$APPDIR/bin:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-mac.jar:../../../../gwt-gadgets.jar" com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@"; Index: samples/gadgetrpc/launch-scripts/mac/GadgetRPC-compile =================================================================== --- samples/gadgetrpc/launch-scripts/mac/GadgetRPC-compile (revision 0) +++ samples/gadgetrpc/launch-scripts/mac/GadgetRPC-compile (revision 0) @@ -0,0 +1,8 @@ +#!/bin/sh +APPDIR=../..; +if [ "$GWT_HOME" == "" ]; then + echo "The environment variable GWT_HOME is not defined, it should point to a valid GWT installation." + exit +fi + +java -cp "$APPDIR/src:$APPDIR/bin:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-mac.jar:../../../../gwt-gadgets.jar" com.google.gwt.dev.GWTCompiler -out "$APPDIR/www" "$@" com.google.gwt.gadgets.sample.gadgetrpc.GadgetRPC; Index: samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd =================================================================== --- samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd (revision 0) +++ samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd (revision 0) @@ -0,0 +1,7 @@ [EMAIL PROTECTED] "%GWT_HOME%"=="" goto needGWTHome [EMAIL PROTECTED] -cp "%~dp0\..\..\src;%~dp0\..\..\bin;%GWT_HOME%\gwt-user.jar;%GWT_HOME%\gwt-dev-windows.jar;..\..\..\..\gwt-gadgets.jar" com.google.gwt.dev.GWTShell -out "%~dp0\..\..\www" %* com.google.gwt.gadgets.sample.gadgetrpc.GadgetRPC/GadgetRPC.html [EMAIL PROTECTED] /B %ERRORLEVEL% + +:needGWTHome [EMAIL PROTECTED] The environment variable GWT_HOME is not defined, it should point to a valid GWT installation. [EMAIL PROTECTED] /B 1 Property changes on: samples/gadgetrpc/launch-scripts/windows/GadgetRPC-shell.cmd ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + CRLF Index: samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd =================================================================== --- samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd (revision 0) +++ samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd (revision 0) @@ -0,0 +1,7 @@ [EMAIL PROTECTED] "%GWT_HOME%"=="" goto needGWTHome [EMAIL PROTECTED] -cp "%~dp0\..\..\src;%~dp0\..\..\bin;%GWT_HOME%\gwt-user.jar;%GWT_HOME%\gwt-dev-windows.jar;..\..\..\..\gwt-gadgets.jar" com.google.gwt.dev.GWTCompiler -out "%~dp0\..\..\www" %* com.google.gwt.gadgets.sample.gadgetrpc.GadgetRPC [EMAIL PROTECTED] /B %ERRORLEVEL% + +:needGWTHome [EMAIL PROTECTED] The environment variable GWT_HOME is not defined, it should point to a valid GWT installation. [EMAIL PROTECTED] /B 1 Property changes on: samples/gadgetrpc/launch-scripts/windows/GadgetRPC-compile.cmd ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + CRLF Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml (revision 0) @@ -0,0 +1,22 @@ +<!-- --> +<!-- Copyright 2008 Google Inc. --> +<!-- Licensed under the Apache License, Version 2.0 (the "License"); you --> +<!-- may not use this file except in compliance with the License. You may --> +<!-- may obtain a copy of the License at --> +<!-- --> +<!-- http://www.apache.org/licenses/LICENSE-2.0 --> +<!-- --> +<!-- Unless required by applicable law or agreed to in writing, software --> +<!-- distributed under the License is distributed on an "AS IS" BASIS, --> +<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> +<!-- implied. License for the specific language governing permissions and --> +<!-- limitations under the License. --> + +<module> + <inherits name="com.google.gwt.user.User" /> + <inherits name="com.google.gwt.gadgets.Gadgets" /> + <inherits name="com.google.gwt.http.HTTP" /> + <inherits name="com.google.gwt.user.theme.standard.Standard" /> + <entry-point class="com.google.gwt.gadgets.sample.gadgetrpc.client.GadgetRPC" /> + <servlet path="/GadgetRPC" class="com.google.gwt.gadgets.sample.gadgetrpc.server.GadgetRPCServlet" /> +</module> Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/GadgetRPC.gwt.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java (revision 0) @@ -0,0 +1,42 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.server; + +import com.google.gwt.gadgets.sample.gadgetrpc.client.GadgetService; +import com.google.gwt.gadgets.sample.gadgetrpc.client.ServerInfo; +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +import java.util.Date; + +/** + * A sample servlet that returns information about the server. + */ +public class GadgetRPCServlet extends RemoteServiceServlet implements + GadgetService { + private static Date servletStartTime = new Date(); + + protected boolean checkHeaders() { + return false; + } + + public ServerInfo getServerInfo() { + ServerInfo info = new ServerInfo(); + info.servletStartTime = servletStartTime; + info.currentTime = new Date(); + return info; + } + +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/server/GadgetRPCServlet.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java (revision 0) @@ -0,0 +1,108 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.client; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.gadgets.client.Gadget; +import com.google.gwt.gadgets.client.IntrinsicFeature; +import com.google.gwt.gadgets.client.NeedsIntrinsics; +import com.google.gwt.gadgets.client.Gadget.ModulePrefs; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwt.user.client.ui.Widget; + +/** + * A demonstration of how to use GWT RPC with the gwt-gadgets library. + */ [EMAIL PROTECTED](title = "Gadget RPC Demo", author = "Eric Z", author_email = "[EMAIL PROTECTED]") +public class GadgetRPC extends Gadget<GadgetRPCPreferences> implements NeedsIntrinsics { + + private IntrinsicFeature intrinsicMethods = null; + private GadgetRPCPreferences prefs = null; + private Label serverStartedText = new Label("<not retrieved>"); + private Label serverCurrentText = new Label("<not retrieved>"); + private Label exceptionInfo = new Label(); + private GadgetServiceAsync gadgetService; + private AsyncCallback<ServerInfo> rpcCallback = new AsyncCallback<ServerInfo>() { + + public void onFailure(Throwable caught) { + Window.alert("RPC Failed: " + caught); + exceptionInfo.setText(caught.toString()); + } + + public void onSuccess(ServerInfo result) { + serverStartedText.setText(result.servletStartTime.toString()); + serverCurrentText.setText(result.currentTime.toString()); + } + }; + + public void initializeFeature(IntrinsicFeature feature) { + this.intrinsicMethods = feature; + } + + @Override + protected void init(GadgetRPCPreferences preferences) { + this.prefs = preferences; + + gadgetService = GWT.create(GadgetService.class); + // If the gadget has caching turned on, change the service entry point. This works + // around the Single Origin Policy(SOP) when the gadget is hosted inside the gadget spec. + ServiceDefTarget serviceDef = (ServiceDefTarget) gadgetService; + String rpcUrl = serviceDef.getServiceEntryPoint(); + if (prefs.useCachedXHR().getValue()) { + rpcUrl = intrinsicMethods.getCachedUrl(rpcUrl); + serviceDef.setServiceEntryPoint(rpcUrl); + } + + // Build the user interface. + VerticalPanel vp = new VerticalPanel(); + vp.setWidth("100%"); + + vp.add(new Label("RPC to: " + rpcUrl)); + + HorizontalPanel startedHp = new HorizontalPanel(); + startedHp.add(new Label("Server Start Time: ")); + startedHp.add(serverStartedText); + vp.add(startedHp); + + HorizontalPanel currentHp = new HorizontalPanel(); + currentHp.add(new Label("Server Current Time: ")); + currentHp.add(serverCurrentText); + vp.add(currentHp); + + Button doRPCButton = new Button("Call RPC Method"); + vp.add(doRPCButton); + + vp.add(exceptionInfo); + + RootPanel.get().add(vp); + + // Setup a button listener to invoke the RPC. + doRPCButton.addClickListener(new ClickListener() { + + public void onClick(Widget sender) { + gadgetService.getServerInfo(rpcCallback); + } + }); + } +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPC.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java (revision 0) @@ -0,0 +1,27 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.client; + +import com.google.gwt.gadgets.client.BooleanPreference; +import com.google.gwt.gadgets.client.UserPreferences; + +/** + * Values the user can change using the preferences interface on the gadget. + */ +public interface GadgetRPCPreferences extends UserPreferences { + @PreferenceAttributes(display_name = "Used Cached XHR methods", default_value = "true") + BooleanPreference useCachedXHR(); +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetRPCPreferences.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java (revision 0) @@ -0,0 +1,27 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.client; + +import java.io.Serializable; +import java.util.Date; + +/** + * Payload returned from the server. + */ +public class ServerInfo implements Serializable { + public Date servletStartTime; + public Date currentTime; +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/ServerInfo.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java (revision 0) @@ -0,0 +1,25 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.client; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * An asynchronous counterpart to the [EMAIL PROTECTED] GadgetService} interface methods. + */ +public interface GadgetServiceAsync { + void getServerInfo(AsyncCallback<ServerInfo> callback); +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetServiceAsync.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java (revision 0) @@ -0,0 +1,27 @@ +/* + * Copyright 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.gadgets.sample.gadgetrpc.client; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +/** + * A Sample RPC Interface to demonstrate RPC usage with Gadgets. + */ [EMAIL PROTECTED]("GadgetRPC") +public interface GadgetService extends RemoteService { + ServerInfo getServerInfo(); +} Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/client/GadgetService.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html =================================================================== --- samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html (revision 0) +++ samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html (revision 0) @@ -0,0 +1,15 @@ +<html> +<head> +<title>GadgetsRPC! (almost)</title> +</head> +<body> +<h1>Gadget RPC Demo</h1> +<p>In order to debug Gadgets in hosted mode, you must make the +generated Gadget manifest available to a Gadget container such as <a + href="http://google.com/ig">iGoogle</a> or <a + href="http://incubator.apache.org/projects/shindig.html">Apache +Shindig</a>. Compile and publish your Gadget in the usual fashion, start +hosted-mode with the <code>-noserver</code> option, then visit the +gadget container with the hosted-mode browser.</p> +</body> +</html> Property changes on: samples/gadgetrpc/src/com/google/gwt/gadgets/sample/gadgetrpc/public/GadgetRPC.html ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: samples/gadgetrpc/build.xml =================================================================== --- samples/gadgetrpc/build.xml (revision 0) +++ samples/gadgetrpc/build.xml (revision 0) @@ -0,0 +1,6 @@ +<project name="GadgetRPC" default="build" basedir="."> + <property name="sample.api" value="gadgets"/> + <property name="sample.root" value="gadgetrpc" /> + <property name="sample.module" value="GadgetRPC" /> + <import file="../common.ant.xml" /> +</project> Property changes on: samples/gadgetrpc/build.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:keywords + Date Author Id Revision HeadURL Name: svn:eol-style + native Index: eclipse/samples/gadgetrpc/.classpath =================================================================== --- eclipse/samples/gadgetrpc/.classpath (revision 0) +++ eclipse/samples/gadgetrpc/.classpath (revision 0) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/> + <classpathentry combineaccessrules="false" kind="src" path="/gwt-gadgets"/> + <classpathentry kind="output" path="bin"/> +</classpath> Index: eclipse/samples/gadgetrpc/.project =================================================================== --- eclipse/samples/gadgetrpc/.project (revision 0) +++ eclipse/samples/gadgetrpc/.project (revision 0) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>GadgetRPC</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>src</name> + <type>2</type> + <locationURI>GADGETS_API_ROOT/samples/gadgetrpc/src</locationURI> + </link> + </linkedResources> +</projectDescription> Index: eclipse/samples/gadgetrpc/.checkstyle =================================================================== --- eclipse/samples/gadgetrpc/.checkstyle (revision 0) +++ eclipse/samples/gadgetrpc/.checkstyle (revision 0) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> +</fileset-config> Index: samples/build.xml =================================================================== --- samples/build.xml (revision 754) +++ samples/build.xml (working copy) @@ -10,8 +10,12 @@ <gwt.ant dir="hellogadgets" /> </target> - <target name="-do" depends="hellogadgets" description="Run all subprojects" /> + <target name="gadgetrpc" description="Build GadgetRPC"> + <gwt.ant dir="gadgetrpc" /> + </target> + <target name="-do" depends="hellogadgets,gadgetrpc" description="Run all subprojects" /> + <target name="build" description="Builds Gadgets API Library for GWT Samples"> <antcall target="-do"> <param name="target" value="build" />
