1

我尝试过使用 Jersey、RESTful、Restlet 的 gwt 应用程序支持什么类型的 Web 服务,但 GWT 没有任何效果。我想在 Tomcat 上部署 Web 服务,在应用引擎上部署 GWT 应用程序。

4

2 回答 2

1

您可以使用 RPC 和 RequestBuilder:

https://developers.google.com/web-toolkit/doc/latest/DevGuideServerCommunication

您还可以使用 RESTful 服务:

如何从 GWT 调用 RESTFUL 服务?

于 2012-11-08T07:06:33.333 回答
1

感谢您的支持。. 我得到了我的问题的答案。我使用 Jersey 创建了一个 restfull web 服务,并在我的 gwt 应用程序引擎应用程序中使用以下代码调用它:

ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(UriBuilder.fromUri("http://localhost:8080/de.vogella.jersey.first").build());
String obj=service.path("rest").path("bye").accept(MediaType.TEXT_PLAIN).get(String.class);

Web 应用程序代码是:package de.vogella.jersey.first;

import javax.ws.rs.*;

@Path("/bye")
public class Hello {

// This method is called if TEXT_PLAIN is request
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
  return "Hello it worked";
}

对于 Web 应用程序代码,请参阅此链接: http ://www.vogella.com/articles/REST/article.html

于 2012-11-09T04:27:14.720 回答