Mercurial Hosting > luan
comparison web/src/luan/modules/web/Web_server.luan @ 272:eb27e765affb
rename Io.protocols to Io.schemes and "class:" to "java:"
git-svn-id: https://luan-java.googlecode.com/svn/trunk@273 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 31 Oct 2014 04:50:24 +0000 |
parents | 1507149fc447 |
children | 38bd29e59a6e |
comparison
equal
deleted
inserted
replaced
271:82a3ebcfbafa | 272:eb27e765affb |
---|---|
2 import "luan:String" | 2 import "luan:String" |
3 import "luan:Io" | 3 import "luan:Io" |
4 import "luan:Package" | 4 import "luan:Package" |
5 import "luan:web/Http" | 5 import "luan:web/Http" |
6 | 6 |
7 import "class:org.eclipse.jetty.server.Server" | 7 import "java:org.eclipse.jetty.server.Server" |
8 import "class:org.eclipse.jetty.server.NCSARequestLog" | 8 import "java:org.eclipse.jetty.server.NCSARequestLog" |
9 import "class:org.eclipse.jetty.server.handler.DefaultHandler" | 9 import "java:org.eclipse.jetty.server.handler.DefaultHandler" |
10 import "class:org.eclipse.jetty.server.handler.HandlerList" | 10 import "java:org.eclipse.jetty.server.handler.HandlerList" |
11 import "class:org.eclipse.jetty.server.handler.HandlerCollection" | 11 import "java:org.eclipse.jetty.server.handler.HandlerCollection" |
12 import "class:org.eclipse.jetty.server.handler.ResourceHandler" | 12 import "java:org.eclipse.jetty.server.handler.ResourceHandler" |
13 import "class:org.eclipse.jetty.server.handler.RequestLogHandler" | 13 import "java:org.eclipse.jetty.server.handler.RequestLogHandler" |
14 import "class:org.eclipse.jetty.server.handler.ContextHandler" | 14 import "java:org.eclipse.jetty.server.handler.ContextHandler" |
15 import "class:org.eclipse.jetty.server.handler.GzipHandler" | 15 import "java:org.eclipse.jetty.server.handler.GzipHandler" |
16 import "class:org.eclipse.jetty.server.handler.HandlerWrapper" | 16 import "java:org.eclipse.jetty.server.handler.HandlerWrapper" |
17 import "class:org.eclipse.jetty.server.session.SessionHandler" | 17 import "java:org.eclipse.jetty.server.session.SessionHandler" |
18 import "class:luan.modules.web.AuthenticationHandler" | 18 import "java:luan.modules.web.AuthenticationHandler" |
19 | 19 |
20 | 20 |
21 port = 8080 | 21 port = 8080 |
22 | 22 |
23 private_password = "password" | 23 private_password = "password" |
71 end | 71 end |
72 | 72 |
73 function serve(dir) | 73 function serve(dir) |
74 dir = dir.gsub("/$","") -- remove trailing '/' if any | 74 dir = dir.gsub("/$","") -- remove trailing '/' if any |
75 Http.dir = dir | 75 Http.dir = dir |
76 function Io.protocols.site(path,loading) | 76 function Io.schemes.site(path,loading) |
77 return Io.Uri( dir..path, loading ) | 77 return Io.Uri( dir..path, loading ) |
78 end | 78 end |
79 authentication_handler.setPassword(private_password) | 79 authentication_handler.setPassword(private_password) |
80 local base = dir | 80 local base = dir |
81 if base.match("^classpath:") ~= nil then | 81 if base.match("^classpath:") ~= nil then |