Package org.restlet

Examples of org.restlet.Component


            e.printStackTrace();
        }
    }

    protected String start() throws Exception {
        this.component = new Component();

        final Server server = this.component.getServers()
                .add(Protocol.HTTPS, 0);
        configureSslServerParameters(server.getContext());
        final Application application = createApplication(this.component);
View Full Code Here


     */
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        Representation xml = new StringRepresentation(RESTLET_XML);
        c = new Component(xml);
        assertNotNull("Component (parsed) MUST NOT be null", c);
    }
View Full Code Here

    public void setUp() throws Exception {
        super.setUp();
        this.client = new Client(Protocol.HTTP);

        if (this.component == null) {
            this.component = new Component();
            this.component.getServers().add(Protocol.HTTP, TEST_PORT);
            this.component.getDefaultHost().attachDefault(
                    new TestHeaderRestlet());
        }
View Full Code Here

                .append("<attach uriPattern=\"/efgh\" targetClass=\"org.restlet.test.component.HelloWorldApplication\" /> ");
        config.append("</host>");

        config.append("</component>");

        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"));
        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"));
        assertTrue(response.getStatus().isClientError());

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

        ClassPathResource resource = new ClassPathResource(
                "org/restlet/test/ext/spring/SpringTestCase.xml");
        BeanFactory factory = new XmlBeanFactory(resource);

        // Start the Restlet component
        Component component = (Component) factory.getBean("component");
        component.start();
        Thread.sleep(500);
        component.stop();
    }
View Full Code Here

     * @throws Exception
     */
    public void startServer(Application application, Protocol protocol)
            throws Exception {

        final Component comp = new Component();
        comp.getServers().add(protocol, 0);

        // Attach the application to the component and start it
        comp.getDefaultHost().attach(application);
        comp.start();
        this.component = comp;
        System.out.println("listening on port " + getServerPort());
    }
View Full Code Here

     * @param port the listening HTTP port
     * @param the application object, if you want to create it by yourself.
     */
    public StandaloneMiniConsole(int port, MiniConsoleApplication application) {
        // Create a new Component.
        component = new Component();
        component.getClients().add(Protocol.CLAP);
        // Add a new HTTP server
        component.getServers().add(Protocol.HTTP, port);

        // Attach the sample application.
View Full Code Here

        return router;
    }

    public static void main(String[] args) throws Exception {
          
            Component component = new Component();
            component.getClients().add(Protocol.FILE);
            //TODO: To test with the restlet 2.1 Maybe the maxTotalConnections could be avoided
            // see: http://restlet-discuss.1400322.n2.nabble.com/rejectedExecution-td4513620.html
            //component.getServers().add(Protocol.HTTP, SERVER_PORT);
            Server server = new Server(Protocol.HTTP, 8111);                    
            component.getServers().add(server);
            server.getContext().getParameters().add("maxTotalConnections", "50");
            //end TODO
            Engine.getInstance().getRegisteredServers().clear();
            Engine.getInstance().getRegisteredServers().add(new HttpServerHelper(server));
            component.getClients().add(Protocol.FILE);               
            component.getDefaultHost().attach(new FreedomRestServer());
            component.start();
    }   
View Full Code Here

   
    @Override
    public void onStart() {
        try {
            super.onStart();
            component = new Component();
            component.getClients().add(Protocol.FILE);
            //TODO: To test with the restlet 2.1 Maybe the maxTotalConnections could be avoided
            // see: http://restlet-discuss.1400322.n2.nabble.com/rejectedExecution-td4513620.html
            //component.getServers().add(Protocol.HTTP, SERVER_PORT);
            Server server = new Server(Protocol.HTTP, SERVER_PORT);
View Full Code Here

    private Boolean pipeliningConnections;
    private Integer threadMaxIdleTimeMs;
    private Boolean useForwardedForHeader;

    public RestletComponent() {
        this.component = new Component();
    }
View Full Code Here

TOP

Related Classes of org.restlet.Component

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.