Package org.restlet

Examples of org.restlet.Client.handle()


        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, LONG_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);

        assertEquals("Long username w/wrong pw did not throw 403",
                Status.CLIENT_ERROR_UNAUTHORIZED, response.getStatus());
       
        client.stop();
View Full Code Here


    // Test various HTTP Basic auth connections
    public void HTTPBasicNone() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);
        final Response response = client.handle(request);
        assertEquals("No user did not throw 401",
                Status.CLIENT_ERROR_UNAUTHORIZED, response.getStatus());
        client.stop();
    }
View Full Code Here

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, SHORT_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
        assertEquals("Short username did not return 200 OK", Status.SUCCESS_OK,
                response.getStatus());
        assertEquals(AUTHENTICATED_MSG, response.getEntity().getText());
       
        client.stop();
View Full Code Here

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, SHORT_USERNAME, LONG_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);

        assertEquals("Short username did not throw 401",
                Status.CLIENT_ERROR_UNAUTHORIZED, response.getStatus());
       
        client.stop();
View Full Code Here

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, WRONG_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);

        assertEquals("Wrong username did not throw 401",
                Status.CLIENT_ERROR_UNAUTHORIZED, response.getStatus());
       
        client.stop();
View Full Code Here

        final Component component = new Component(config);
        component.start();

        final Client client = new Client(Protocol.HTTP);

        Response response = client.handle(new Request(Method.GET,
                "http://localhost:" + this.port + "/efgh"));
        assertTrue(response.getStatus().isSuccess());
        assertTrue(response.isEntityAvailable());
        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port + "/abcd"));
View Full Code Here

        Response response = client.handle(new Request(Method.GET,
                "http://localhost:" + this.port + "/efgh"));
        assertTrue(response.getStatus().isSuccess());
        assertTrue(response.isEntityAvailable());
        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port + "/abcd"));
        assertTrue(response.getStatus().isClientError());

        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port2 + "/abcd"));
View Full Code Here

        assertTrue(response.isEntityAvailable());
        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port + "/abcd"));
        assertTrue(response.getStatus().isClientError());

        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port2 + "/abcd"));
        assertTrue(response.getStatus().isSuccess());
        assertTrue(response.isEntityAvailable());
        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port2 + "/efgh"));
View Full Code Here

        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port2 + "/abcd"));
        assertTrue(response.getStatus().isSuccess());
        assertTrue(response.isEntityAvailable());
        response = client.handle(new Request(Method.GET, "http://localhost:"
                + this.port2 + "/efgh"));
        assertTrue(response.getStatus().isClientError());

        component.stop();
        client.stop();
View Full Code Here

        client.getContext().getParameters().add("debug", DEBUG);
        client.getContext().getParameters()
                .add("startTls", Boolean.toString(startTls).toLowerCase());

        request.setEntity(MAIL, MediaType.APPLICATION_XML);
        final Response response = client.handle(request);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        client.stop();
    }

    @Override
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.