parent
83f503b86f
commit
6e2db6993b
|
@ -45,18 +45,17 @@ public class FileServer
|
||||||
// In this example it is the current directory but it can be configured to anything that the jvm has access to.
|
// In this example it is the current directory but it can be configured to anything that the jvm has access to.
|
||||||
resource_handler.setDirectoriesListed(true);
|
resource_handler.setDirectoriesListed(true);
|
||||||
resource_handler.setWelcomeFiles(new String[]{ "index.html" });
|
resource_handler.setWelcomeFiles(new String[]{ "index.html" });
|
||||||
resource_handler.setResourceBase("/tmp/docroot");
|
resource_handler.setResourceBase(".");
|
||||||
|
|
||||||
// Add the ResourceHandler to the server.
|
// Add the ResourceHandler to the server.
|
||||||
HandlerList handlers = new HandlerList();
|
HandlerList handlers = new HandlerList();
|
||||||
handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
|
handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
|
||||||
server.setHandler(handlers);
|
server.setHandler(handlers);
|
||||||
|
|
||||||
/*
|
// Add GzipHandler
|
||||||
GzipHandler gzip = new GzipHandler();
|
GzipHandler gzip = new GzipHandler();
|
||||||
server.setHandler(gzip);
|
server.setHandler(gzip);
|
||||||
gzip.setHandler(handlers);
|
gzip.setHandler(handlers);
|
||||||
*/
|
|
||||||
|
|
||||||
// Start things up! By using the server.join() the server thread will join with the current thread.
|
// Start things up! By using the server.join() the server thread will join with the current thread.
|
||||||
// See "http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#join()" for more details.
|
// See "http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#join()" for more details.
|
||||||
|
|
Loading…
Reference in New Issue