2012-01-21 11 views
2

に、私は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(); 
    } 

} 

答えて

1

"必要なプロトコルをサポートしているサーバーコネクタがありません: 'HTTP' 。たとえば :GWTクライアントはコアのみのRestlet JARに依存している(org.restlet.jar、あなたのクラスパスに関連するjarファイルを追加したことを確認してください「あなたのクラスパスに

を対応するコネクタのJARを追加してください。 )また、よくある質問:What JAR files must I have in my classpath for a minimal application?を参照してくださいまた、ここに答えを参照してください:No available client connector supports the required protocol: 'HTTP'

+0

ええ、私は必要なjarファイルを追加して、私は内蔵のHTTPクライアントとサーバー! – Rangesh