Package org.restlet

Examples of org.restlet.Context


        ConnectorHelper<Server> helper;
        helper = new org.restlet.engine.connector.HttpServerHelper(null);
        Engine.getInstance().getRegisteredServers().add(0, helper);
        Engine.setLogLevel(Level.FINE);

        Server server = new Server(new Context(), Protocol.HTTP, 8554,
                new Restlet() {
                    @Override
                    public void handle(Request request, Response response) {
                        FileRepresentation fr = new FileRepresentation(
                                "file:///c:/TEST/restlet-jse-2.0.5-ff.zip",
View Full Code Here


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

        assertEquals(r.getStatus().getDescription(), Status.SUCCESS_OK,
View Full Code Here

        if (!SystemUtils.isWindows()) {
            Request request;
            Response response;

            BioUtils.delete(testDir, true);
            Client client = new Client(new Context(), Protocol.HTTP);
            client.getContext().getParameters().add("tracing", "true");

            // PUT on a file that does not exist
            request = new Request(Method.PUT, "http://localhost:" + TEST_PORT
                    + "/testPut/essai.txt");
View Full Code Here

        // Register the selected connector
        Engine.getInstance().getRegisteredServers().add(0, helper);
        // Engine.setLogLevel(Level.FINEST);

        // Create and start a connector instance
        Server server = new Server(new Context(), Protocol.HTTP, 9999);
        server.getContext().getParameters().add("tracing", "false");
        server.getContext().getParameters().add("minThreads", "1");
        server.getContext().getParameters().add("lowThreads", "30");
        server.getContext().getParameters().add("maxThreads", "40");
        server.getContext().getParameters().add("maxQueued", "0");
View Full Code Here

                .get(0);
        assertNotNull(
                "The first Attach element of the Default Host MUST NOT be null",
                route);
        String msg = "[" + ATTACH + " #1] ";
        Context ctx = route.getNext().getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "3");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "4");
View Full Code Here

                .get(1);
        assertNotNull(
                "The second Attach element of the Default Host MUST NOT be null",
                route);
        String msg = "[" + ATTACH + " #2] ";
        Context ctx = route.getNext().getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "3");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "4");
View Full Code Here

                .get(0);
        assertNotNull(
                "The single Attach element of the Single Host MUST NOT be null",
                route);
        String msg = "[" + ATTACH + "] ";
        Context ctx = route.getNext().getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "3");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "4");
View Full Code Here

        assertEquals("Client list MUST contain 1 item", 1, clients.size());
        Client client = clients.get(0);
        assertNotNull("The single Client MUST NOT be null", client);

        String msg = "[" + CLIENT + "] ";
        Context ctx = client.getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkPositiveParam(msg, ctx, CON_PARAM_NAME + "3", CON_PARAM_VALUE
                + "3");
View Full Code Here

    public void testComponentParams() throws Exception {
        System.out.println("-- testComponentParams()");

        String msg = "[" + COMPONENT + "] ";
        Context ctx = c.getContext();

        checkPositiveParam(msg, ctx, C_NAME + "1", C_VALUE + "1");
        checkPositiveParam(msg, ctx, C_NAME + "2", C_VALUE + "2");

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
View Full Code Here

        System.out.println("-- testDefaultHostParams()");

        VirtualHost dh = c.getDefaultHost();
        assertNotNull("Default Host MUST NOT be null", dh);
        String msg = "[" + HOST + ":" + dh.getHostPort() + "] ";
        Context ctx = dh.getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "3");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "4");
View Full Code Here

TOP

Related Classes of org.restlet.Context

Copyright © 2018 www.massapicom. 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.