Created
February 3, 2014 07:48
-
-
Save matzew/8780180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.wessendorf.undertow; | |
| import io.undertow.Undertow; | |
| import io.undertow.server.handlers.resource.FileResourceManager; | |
| import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer; | |
| import java.io.File; | |
| import java.util.logging.Logger; | |
| import static io.undertow.Handlers.resource; | |
| public class Server { | |
| private static final Logger logger = Logger.getLogger(Server.class.getName()); | |
| public static void main(String[] args) { | |
| UndertowJaxrsServer ut = new UndertowJaxrsServer(); | |
| ut.start( | |
| Undertow.builder() | |
| .addHttpListener(8080, "localhost") | |
| .setHandler(resource(new FileResourceManager(new File(System.getProperty("user.home")), 100)) | |
| .setDirectoryListingEnabled(true)) | |
| ); | |
| try { | |
| Thread.currentThread().join(); | |
| } | |
| catch (InterruptedException e) { | |
| logger.info("shutting down"); | |
| ut.stop(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment