[undertow-dev] serving static files

Matthias Wessendorf matzew at redhat.com
Sun Feb 2 06:58:14 EST 2014


Hello,

I might be just doing it wrong, but the following attempts are not successful for serving static files from a folder:


        UndertowJaxrsServer ut = new UndertowJaxrsServer();
 
        MyRestApplication app = new MyRestApplication();
 
        ut.deploy(app);
 
        ut.start(
                Undertow.builder()
                        .addHttpListener(8080, "0.0.0.0")

 
                // first tried this:
                        .setHandler(path()
                                    .addPrefixPath("/",resource(new FileResourceManager(new File("/some/folder/containing/html/files"), 1024))))
 

                // afterwards also tried this:
                        .setHandler(resource(new FileResourceManager(new File("/some/folder/containing/html/files"), 1024)))
        );
 
        try {
            Thread.currentThread().join();
        }
        catch (InterruptedException e) {
            logger.info("shutting down");
            ut.stop();
        }




Not sure, but none of the above handlers seems to server files from a folder on my box


Greetings,
Matthias





-- 
Matthias Wessendorf
matzew at redhat.com

JBoss, by Red Hat


More information about the undertow-dev mailing list