Package org.webbitserver

Examples of org.webbitserver.WebServer


import static org.webbitserver.WebServers.createWebServer;

public class Main {

    public static void main(String[] args) throws Exception {
        WebServer webServer = createWebServer(9876)
                .add(new LoggingHandler(new SimpleLogSink(Chatroom.USERNAME_KEY)))
                .add("/chatsocket", new Chatroom())
                .add(new StaticFileHandler("./src/test/java/samples/flashchatroom/content"))
                .start().get();

        System.out.println("Chat room running on: " + webServer.getUri());
    }
View Full Code Here


    public static void main(String[] args) throws ExecutionException, InterruptedException {
        InMemoryPasswords passwords = new InMemoryPasswords()
                .add("joe", "secret")
                .add("jeff", "somepassword");

        WebServer webServer = createWebServer(45453)
                .add(new BasicAuthenticationHandler(passwords))
                .add("/whoami", new WhoAmIHttpHandler())
                .add("/whoami-ws", new WhoAmIWebSocketHandler())
                .add(new StaticFileHandler("src/test/java/samples/authentication/content"))
                .start().get();

        System.out.println("Running on " + webServer.getUri());
    }
View Full Code Here

        MutablePicoContainer container = registerComponents();
        container.start();

        try {
            WebServer server = WebServers.createWebServer(PORT)
                                         .add("/agents", container.getComponent(WebSocketMachineSource.class))
                                         .add("/clients", container.getComponent(ClientHandler.class))
                                         .add(new StaticFileHandler(staticDir));

            server.start().get();
        } finally {
            container.stop();
        }
    }
View Full Code Here

TOP

Related Classes of org.webbitserver.WebServer

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.