32ba5791dea420c6a0d5cbe430083f45369eaaa3
[project/luci.git] / libs / lucid-http / luasrc / lucid / http.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2009 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local require, ipairs, pcall = require, ipairs, pcall
16 local srv = require "luci.lucid.http.server"
17
18 module "luci.lucid.http"
19
20 function factory(publisher)
21 local server = srv.Server()
22 for _, r in ipairs(publisher) do
23 local t = r[".type"]
24 local s, mod = pcall(require, "luci.lucid.http." .. (r[".type"] or ""))
25 if s and mod then
26 mod.factory(server, r)
27 else
28 return nil, mod
29 end
30 end
31
32 return function(...) return server:process(...) end
33 end