Mercurial Hosting > luan
changeset 174:609c5b3118db
add Web_server.luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@175 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 23 Jun 2014 02:57:50 +0000 |
parents | 58c6ca5d4524 |
children | bdbd4740121f |
files | web/ext/jetty-continuation-7.6.0.v20120127.jar web/ext/jetty-http-7.6.0.v20120127.jar web/ext/jetty-io-7.6.0.v20120127.jar web/ext/jetty-server-7.6.0.v20120127.jar web/ext/jetty-util-7.6.0.v20120127.jar web/src/luan/modules/web/Web_server.luan |
diffstat | 6 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 58c6ca5d4524 -r 609c5b3118db web/ext/jetty-continuation-7.6.0.v20120127.jar Binary file web/ext/jetty-continuation-7.6.0.v20120127.jar has changed
diff -r 58c6ca5d4524 -r 609c5b3118db web/ext/jetty-http-7.6.0.v20120127.jar Binary file web/ext/jetty-http-7.6.0.v20120127.jar has changed
diff -r 58c6ca5d4524 -r 609c5b3118db web/ext/jetty-io-7.6.0.v20120127.jar Binary file web/ext/jetty-io-7.6.0.v20120127.jar has changed
diff -r 58c6ca5d4524 -r 609c5b3118db web/ext/jetty-server-7.6.0.v20120127.jar Binary file web/ext/jetty-server-7.6.0.v20120127.jar has changed
diff -r 58c6ca5d4524 -r 609c5b3118db web/ext/jetty-util-7.6.0.v20120127.jar Binary file web/ext/jetty-util-7.6.0.v20120127.jar has changed
diff -r 58c6ca5d4524 -r 609c5b3118db web/src/luan/modules/web/Web_server.luan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/src/luan/modules/web/Web_server.luan Mon Jun 23 02:57:50 2014 +0000 @@ -0,0 +1,23 @@ +import "Java" + +import "org.eclipse.jetty.server.Server" +import "org.eclipse.jetty.server.handler.DefaultHandler" +import "org.eclipse.jetty.server.handler.HandlerList" +import "org.eclipse.jetty.server.handler.ResourceHandler" + + +port = 8080 + + +resource_handler = ResourceHandler.new() + +handlers = HandlerList.new() +handlers.setHandlers { resource_handler, DefaultHandler.new() } + + +function serve(dir) + resource_handler.setResourceBase(dir) + local server = Server.new(port) + server.setHandler(handlers); + server.start() +end