Hi,
I am just setting up Restlet at home. (Restlet-1.0rc6.zip)
I am just playing around at the moment and I have converted SimpleClient.java
into a Junit test.
I have com.noelios.restlet.jar and org.restlet.jar in my classpath but get this
warning.
(Using jre1.5.0_10).
10/04/2007 23:47:58 com.noelios.restlet.Engine createHelper
WARNING: No available client connector supports the required protocols: HTTP .
Please add the JAR of a matching connector to your classpath.
Can someone tell me is this classpath or a config issue?
Regards
Donald.
public class SimpleClientTest extends TestCase {
public void testSimpleForm() throws Exception {
// Prepare the REST call.
Request request = new Request();
// Identify ourselves.
request.setReferrerRef("http://www.foo.com/");
// Target resource.
request.setResourceRef("http://127.0.0.1:9876/test");
// Action: Update
request.setMethod(Method.PUT);
Form form = new Form();
form.add("name", "John D. Mitchell");
form.add("email", "[EMAIL PROTECTED]");
form.add("email2", "[EMAIL PROTECTED]");
request.setEntity(form.getWebRepresentation());
System.out.println("client: one!");
// Prepare HTTP client connector.
Client client = new Client(Protocol.HTTP);
System.out.println("client: two!");
client.getLogger().log(Level.INFO, "client: two!");
// Make the call.
Response response = client.handle(request);
client.getLogger().log(Level.INFO, "client: three!");
if (response.getStatus().isSuccess()) {
client.getLogger().log(Level.INFO, "client: four!");
// Output the response entity on the JVM console
response.getEntity().write(System.out);
System.out.println("client: success!");
} else {
System.out.println(response.getStatus().getDescription());
fail("client: failure!");
}
}
}