2

I worked out a simple hello world application using Restlet in GWT, but it throwed out me with

"No available client connector supports the required protocol: 'HTTP'" in client side and in server side

"No available server connector supports the required protocols: 'HTTP' . Please add the JAR of a matching connector to your classpath."

Here is my hello world app:

Client:

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";
    }
}

Server:

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();
    }

}
Jama A.
  • 15,680
  • 10
  • 55
  • 88
Rangesh
  • 728
  • 2
  • 12
  • 27

1 Answers1

1

"No available server connector supports the required protocols: 'HTTP' . Please add the JAR of a matching connector to your classpath"

Make sure you have added relevant jar file into your classpath: For example:The GWT client relies only on the core Restlet JAR (org.restlet.jar) provided in the GWT edition. And also see FAQ: What JAR files must I have in my classpath for a minimal application? and also see the answer given here: No available client connector supports the required protocol: 'HTTP'

Community
  • 1
  • 1
Jama A.
  • 15,680
  • 10
  • 55
  • 88
  • yup,i have added necessary jar files ,and i am using restlet 2.0,which comes with built-in HTTP client and servers ! – Rangesh Jan 21 '12 at 16:02