Package org.restlet

Examples of org.restlet.Client.handle()


            if (response.isEntityAvailable()) {
                assertEquals("Method=GET/Authority=localhost:" + TEST_PORT,
                        response.getEntity().getText());
            }

            response = client.handle(new Request(Method.GET,
                    "http://localhost:" + TEST_PORT + "/freemarker/"
                            + testFileFm2.getName()));
            assertTrue(response.getStatus().isSuccess());

            if (response.isEntityAvailable()) {
View Full Code Here


            if (response.isEntityAvailable()) {
                assertEquals("Method=${m}/Authority=${ra}", response
                        .getEntity().getText());
            }

            response = client.handle(new Request(Method.GET,
                    "http://localhost:" + TEST_PORT + "/velocity/"
                            + testFileVl1.getName()));

            if (response.isEntityAvailable()) {
                assertEquals("Method=GET/Path=/velocity/testVl1", response
View Full Code Here

            if (response.isEntityAvailable()) {
                assertEquals("Method=GET/Path=/velocity/testVl1", response
                        .getEntity().getText());
            }

            response = client.handle(new Request(Method.GET,
                    "http://localhost:" + TEST_PORT + "/velocity/"
                            + testFileVl2.getName()));
            assertTrue(response.getStatus().isSuccess());

            if (response.isEntityAvailable()) {
View Full Code Here

            digester.exhaust();
            // Set the digest with the computed one
            digester.setDigest(digester.computeDigest());
            request.setEntity(digester);

            Response response = client.handle(request);

            assertEquals(Status.SUCCESS_OK, response.getStatus());
            digester = new DigesterRepresentation(response.getEntity());
            digester.exhaust();
            assertTrue(digester.checkDigest());
View Full Code Here

    @Override
    protected void call(String uri) throws Exception {
        final Request request = new Request(Method.GET, uri);
        Client c = new Client(Protocol.HTTP);
        final Response r = c.handle(request);

        assertEquals(r.getStatus().getDescription(), Status.SUCCESS_OK, r
                .getStatus());
        assertEquals("Hello world", r.getEntity().getText());
        c.stop();
View Full Code Here

    @Override
    protected void call(String uri) throws Exception {
        final Request request = new Request(Method.GET, uri);
        Client c = new Client(Protocol.HTTP);
        final Response r = c.handle(request);
        assertEquals(Status.SUCCESS_OK, r.getStatus());
        c.stop();
    }

    @Override
View Full Code Here

        component.getDefaultHost().attach(application);

        Client client = new Client(new Context(), Protocol.HTTP);
        Request request = new Request(Method.GET, uri);
        Response response = client.handle(request);
        Representation entity = response.getEntity();

        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEquals("abc", entity.getText());
        assertEquals(getClass().getName(), entity.getDisposition()
View Full Code Here

    protected void call(String uri) throws Exception {
        final Request request = new Request(Method.GET, uri);
        final Client client = new Client(Protocol.HTTPS);
        client.setContext(new Context());
        configureSslClientParameters(client.getContext());
        final Response r = client.handle(request);

        assertEquals(r.getStatus().getDescription(), Status.SUCCESS_OK,
                r.getStatus());
        assertEquals("Hello world", r.getEntity().getText());
View Full Code Here

        // Test partial Get.
        Request request = new Request(Method.GET, "http://localhost:"
                + TEST_PORT + "/testGet");
        Response response;

        response = client.handle(request);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEquals("1234567890", response.getEntity().getText());
        assertEquals(10, response.getEntity().getSize());
        assertEquals(10, response.getEntity().getAvailableSize());
View Full Code Here

        assertEquals(10, response.getEntity().getAvailableSize());

        request = new Request(Method.GET, "http://localhost:" + TEST_PORT
                + "/testGet");
        request.setRanges(Arrays.asList(new Range(0, 10)));
        response = client.handle(request);
        assertEquals(Status.SUCCESS_PARTIAL_CONTENT, response.getStatus());
        assertEquals("1234567890", response.getEntity().getText());
        assertEquals(10, response.getEntity().getSize());
        assertEquals(10, response.getEntity().getAvailableSize());
        assertEquals(0, response.getEntity().getRange().getIndex());
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.