Mercurial Hosting > luan
view web/src/luan/modules/web/Http.luan @ 340:fb18724521d2
rename Html.simple_html_page to simply_html_page
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 02:35:40 -0600 |
parents | cd2924a1052c |
children | a8d03e6882c6 |
line wrap: on
line source
java() local Luan = require "luan:Luan" local ipairs = Luan.ipairs local to_string = Luan.to_string local Table = require "luan:Table" require "luan:logging/Logging" -- initialize logging local LuanHandler = require "java:luan.modules.web.LuanHandler" function new_luan_handler() return LuanHandler.new() end function init_for_test() function get_page(mod_name) local mod = require("site:"..mod_name) mod.service() return Table.concat(result) end cookies = cookies or {} request = { parameters = {}; } request.cookies = cookies response = { text_writer = function() result = {} return { write = function(...) for _, v in ipairs{...} do result[#result+1] = to_string(v) end end; } end; set_cookie = function(name,value) cookies[name] = value end; remove_cookie = function(name) cookies[name] = nil end; send_redirect = function(url) response.redirect = url end; headers = {}; } end