に、私はGWTでのRestletを使用して単純なハロー世界のアプリケーションを働いたが、それはのRestlet-のHELLO WORLDは、GWT
で私をthrowed「『HTTP』は使用可能なクライアントコネクタが必要なプロトコルをサポートしていません」クライアント側とサーバー側
"必要なプロトコルをサポートしているサーバーコネクタがありません: 'HTTP' 。一致するコネクタのJARをクラスパスに追加してください。ここで
私のハローワールドアプリです:
クライアント:
import org.restlet.resource.ClientResource;
public class HelloClient {
public static void main(String[] args) throws Exception {
ClientResource helloClientresource = new ClientResource(
"http://localhost:8111/");
helloClientresource.get().write(System.out);
}
}
ServerResource:
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
/**
* Simple "hello, world" server resource.
*/
public class HelloServerResource extends ServerResource {
@Get("txt")
public String represent() {
return "hello, world";
}
}
はサーバー:
import org.restlet.Server;
import org.restlet.data.Protocol;
public class HelloServer {
public static void main(String[] args) throws Exception {
Server helloServer = new Server(Protocol.HTTP, 8111,
HelloServerResource.class);
helloServer.start();
}
}
ええ、私は必要なjarファイルを追加して、私は内蔵のHTTPクライアントとサーバー! – Rangesh