comparison src/luan/modules/http/jetty/Server.luan @ 1149:1b7c20e20ca7

remove /private/ authentication
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 04 Feb 2018 17:23:20 -0700
parents d30d400fd43d
children
comparison
equal deleted inserted replaced
1148:49fb4e83484f 1149:1b7c20e20ca7
34 Server.port = 8080 34 Server.port = 8080
35 35
36 Server.welcome_file = "index.html" 36 Server.welcome_file = "index.html"
37 37
38 38
39 Server.authentication_handler = AuthenticationHandler.new("/private/")
40
41 Server.luan_handler = LuanHandler.new() 39 Server.luan_handler = LuanHandler.new()
42 40
43 Server.resource_handler = ResourceHandler.new() 41 Server.resource_handler = ResourceHandler.new()
44 Server.resource_handler.setDirectoriesListed(true) 42 Server.resource_handler.setDirectoriesListed(true)
45 43
46 Server.handlers = HandlerList.new() 44 Server.handlers = HandlerList.new()
47 Server.handlers.setHandlers { Server.authentication_handler, Server.luan_handler, Server.resource_handler } 45 Server.handlers.setHandlers { Server.luan_handler, Server.resource_handler }
48 46
49 function Server.add_folder(context,dir) 47 function Server.add_folder(context,dir)
50 local rh = ResourceHandler.new() 48 local rh = ResourceHandler.new()
51 rh.setResourceBase(dir) 49 rh.setResourceBase(dir)
52 rh.setDirectoriesListed(true) 50 rh.setDirectoriesListed(true)
83 dir = gsub(dir,"/$","") -- remove trailing '/' if any 81 dir = gsub(dir,"/$","") -- remove trailing '/' if any
84 Http.dir = dir 82 Http.dir = dir
85 function Io.schemes.site(path) 83 function Io.schemes.site(path)
86 return Io.uri( dir..path ) 84 return Io.uri( dir..path )
87 end 85 end
88 Server.authentication_handler.setPassword(Io.password)
89 local base = dir 86 local base = dir
90 if matches(base,"^classpath:") then 87 if matches(base,"^classpath:") then
91 base = dir.."#"..Server.welcome_file.."#"..Server.welcome_file..".luan" 88 base = dir.."#"..Server.welcome_file.."#"..Server.welcome_file..".luan"
92 end 89 end
93 Server.resource_handler.setResourceBase(Io.uri(base).to_string()) 90 Server.resource_handler.setResourceBase(Io.uri(base).to_string())