Package org.restlet

Examples of org.restlet.Client.handle()


    }

    private void sendGet(String uri) throws Exception {
        final Request request = new Request(Method.GET, uri);
        Client c = new Client(Protocol.HTTP);
        final Response r = c.handle(request);
        try {
            assertEquals(r.getStatus().getDescription(), Status.SUCCESS_OK,
                    r.getStatus());
            assertXML(new DomRepresentation(r.getEntity()));
        } finally {
View Full Code Here


    }

    private void sendPut(String uri) throws Exception {
        Request request = new Request(Method.PUT, uri, createTestXml());
        Client c = new Client(Protocol.HTTP);
        Response r = c.handle(request);

        try {
            checkForChunkedHeader(r);
            assertEquals(r.getStatus().getDescription(), Status.SUCCESS_OK,
                    r.getStatus());
View Full Code Here

        // extraHeaders.add("X-Amz-Date", "Thu, 17 Nov 2005 18:49:58 GMT");
        request.getAttributes().put("org.restlet.http.headers", extraHeaders);

        // Handle it using an HTTP client connector
        final Client client = new Client(Protocol.HTTP);
        final Response response = client.handle(request);

        // Write the response entity on the console
        final Representation output = response.getEntity();
        output.write(System.out);
    }
View Full Code Here

        Client dispatcher = comp.getContext().getClientDispatcher();

        String msg = "this%20message";
        String echoURI = localBase + "/echo/" + msg;
        Representation echoRep = dispatcher.handle(
                new Request(Method.GET, echoURI)).getEntity();
        assertEquals("expected echo of uri-remainder", msg, echoRep.getText());

        final String objURI = localBase + "/object";
        final Representation objRep = dispatcher.handle(
View Full Code Here

        Representation echoRep = dispatcher.handle(
                new Request(Method.GET, echoURI)).getEntity();
        assertEquals("expected echo of uri-remainder", msg, echoRep.getText());

        final String objURI = localBase + "/object";
        final Representation objRep = dispatcher.handle(
                new Request(Method.GET, objURI)).getEntity();
        assertSame("expected specific test-object", JUST_SOME_OBJ,
                ((ObjectRepresentation<?>) objRep).getObject());

        final String nullURI = localBase + "/null";
View Full Code Here

                new Request(Method.GET, objURI)).getEntity();
        assertSame("expected specific test-object", JUST_SOME_OBJ,
                ((ObjectRepresentation<?>) objRep).getObject());

        final String nullURI = localBase + "/null";
        final Representation nullRep = dispatcher.handle(
                new Request(Method.GET, nullURI)).getEntity();
        assertNull("expected null",
                ((ObjectRepresentation<?>) nullRep).getObject());

        final String anyURI = localBase + "/whatever";
View Full Code Here

                new Request(Method.GET, nullURI)).getEntity();
        assertNull("expected null",
                ((ObjectRepresentation<?>) nullRep).getObject());

        final String anyURI = localBase + "/whatever";
        final Representation anyRep = dispatcher.handle(
                new Request(Method.GET, anyURI)).getEntity();
        assertEquals("expected echo of uri-remainder", DEFAULT_MSG,
                anyRep.getText());

        final String aggURI = localBase + "/self-aggregated";
View Full Code Here

                new Request(Method.GET, anyURI)).getEntity();
        assertEquals("expected echo of uri-remainder", DEFAULT_MSG,
                anyRep.getText());

        final String aggURI = localBase + "/self-aggregated";
        final Representation aggRep = dispatcher.handle(
                new Request(Method.GET, aggURI)).getEntity();
        final String expectedResult = buildAggregate(ECHO_TEST_MSG,
                ECHO_TEST_MSG);
        assertEquals("expected specific aggregated message", expectedResult,
                aggRep.getText());
View Full Code Here

        Request request = new Request(Method.GET, "http://www.restlet.org");
        request.setProtocol(Protocol.valueOf("SDC"));
        request.setProxyChallengeResponse(new ChallengeResponse(ChallengeScheme
                .valueOf("SDC"), "myUser@example.com", "myPassword"));
        Response response = sdcClient.handle(request);
        response.getEntity().write(System.out);
    }
}
View Full Code Here

            // Allow extensions tunneling
            freemarkerApplication.getTunnelService().setExtensionsTunnel(true);
            velocityApplication.getTunnelService().setExtensionsTunnel(true);
            Client client = new Client(Protocol.HTTP);
            Response response = client.handle(new Request(Method.GET,
                    "http://localhost:" + TEST_PORT + "/freemarker/"
                            + testFileFm1.getName()));

            if (response.isEntityAvailable()) {
                assertEquals("Method=GET/Authority=localhost:" + TEST_PORT,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.