2009/11/26 Ignacio Burgueño <[email protected]>: > I'm forwarding the following message because I think it is relevant here.
It surely was, and I finally managed to update the wiki page http://www.keplerproject.org/en/Xavante_Examples. Sorry for the long delay and thanks both you and Jerome for the source and patience. André > -------- Original Message -------- > Subject: Re: Simple Xavante direct handler > Date: Thu, 26 Nov 2009 15:21:39 +0100 > From: Jerome Vuarand <[email protected]> > Reply-To: Lua list <[email protected]> > To: Lua <[email protected]> > References: <[email protected]> > <[email protected]> > <[email protected]> > <[email protected]> > > 2009/11/25 Ignacio Burgueño <[email protected]>: >> >> Jerome Vuarand wrote: >>> >>> Thanks, I'll give it a look. But afaict this looks like *a lot* of >>> code, for something which is a mere simplification of what Xavante >>> already does. >> >> He! Possibly. I replicated a lot of code because when I started my project >> Xavante was fluctuating a lot, so that gave me better isolation. >> >> But I think you can get away just by copying the two functions >> (makeRawSapiHandler and custom_sapi_loader) > > I finally got it to work with not too much code (most of it given by > Ignacio) but some time wasted. Here is the final webserver code of my > application : > > local function custom_sapi_loader(wsapi_env) > wsapi.common.normalize_paths(wsapi_env) > > _G.CGILUA_ISDIRECT = true > _G.CGILUA_CONF = "." > _G.CGILUA_TMP = "." > > local app = require "wsapi.sapi" > local status, headers, iterator = app.run(wsapi_env) > -- it is necessary to reload Cgilua packages and wsapi.sapi. it has > way too much dependency on global > -- environment > package.loaded["cgilua"] = nil > cgilua.SAPI = nil > package.loaded["wsapi.sapi"] = nil > > return status, headers, iterator > end > > local webdir = ".\\" > xavante.HTTP{ > server = {host = "*", port = web_port}, > > defaultHost = { > rules = { > { > match = "^[^%./]*/$", > with = xavante.redirecthandler, > params = {"index.lp"}, > }, > { > match = "%.lp$", > with = > wsapi.xavante.makeHandler(custom_sapi_loader, nil, webdir, webdir), > }, > { > match = ".", > with = xavante.filehandler, > params = {baseDir = webdir} > }, > }, > }, > } > > I then run my coroutine-based, copas-like event loop. It would be nice > to add in-interpreter processing of LuaPages to Xavante, or to put an > example like the code above in a very visible place. > > > > > _______________________________________________ > Kepler-Project mailing list > [email protected] > http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project > http://www.keplerproject.org/ > _______________________________________________ Kepler-Project mailing list [email protected] http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/
