Mercurial Hosting > luan
view web/src/luan/modules/web/Http.luan @ 326:db37d6aee4db
remove try-catch statement;
add Luan.try() and Luan.pcall();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@327 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Mar 2015 00:01:57 +0000 |
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