Package org.webbitserver.handler

Examples of org.webbitserver.handler.StaticFileHandler


    public static void main(String[] args) throws IOException {
        WebServer webServer = createWebServer(45454)
                .add(new BasicAuthenticationHandler(new SlowPasswordAuthenticator()))
                .add("/whoami", new WhoAmIHttpHandler())
                .add("/whoami-ws", new WhoAmIWebSocketHandler())
                .add(new StaticFileHandler("src/test/java/samples/authentication/content"))
                .start();

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


    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/chatroom/content"))
                .start();

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

        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();

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

    public void start() {
        port = PortProber.findFreePort();
        File htdocs = FileUtils.toFile(getClass().getResource("/htdocs"));
        server = WebServers.createWebServer(port)
            .add("/form_posted\\.html", new FormPosted())
            .add(new StaticFileHandler(htdocs))
            .add("/basic", new BasicAuthenticationHandler(new InMemoryPasswords().add("user", "pass")))
            .add("/redirect", new RedirectHandler("http://" + getServerNameString() + "/index.html"))
            .add("/basic/redirect", new RedirectHandler("http://" + getServerNameString() + "/basic/index.html"));
        try {
            server.start().get();
View Full Code Here

*/
public class AudioTagUsesRangesExample {

    public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
        WebServer webServer = createWebServer(45453)
                .add(new StaticFileHandler("src/test/java/samples/ranges/content"))
                .start().get();

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

    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/chatroom/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 {
        WebServer webServer = createWebServer(45454)
                .add(new BasicAuthenticationHandler(new SlowPasswordAuthenticator()))
                .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

    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

        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

        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.handler.StaticFileHandler

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.