Mercurial Hosting > luan
diff src/luan/modules/http/Http.luan @ 1088:bae2d0c2576c
change module naming convention
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 26 Dec 2016 22:29:36 -0700 |
parents | ece3567d4df5 |
children | b1c3baf3aa46 |
line wrap: on
line diff
--- a/src/luan/modules/http/Http.luan Mon Dec 19 01:38:21 2016 -0700 +++ b/src/luan/modules/http/Http.luan Mon Dec 26 22:29:36 2016 -0700 @@ -15,7 +15,7 @@ local HttpServicer = require "java:luan.modules.http.HttpServicer" local IoLuan = require "java:luan.modules.IoLuan" -local M = {} +local Http = {} local singular_metatable = {} @@ -42,7 +42,7 @@ local sent_error_metatable = { __index=sent_error, __new_index=sent_error } -function M.sent_headers(headers) +function Http.sent_headers(headers) clear(headers) set_metatable(headers,sent_error_metatable) end @@ -57,7 +57,7 @@ end -function M.new_request(this) +function Http.new_request(this) this = new_common(this) this.method = "GET" -- default -- this.path @@ -102,9 +102,9 @@ OK = 200; -- add more as needed } -M.STATUS = STATUS +Http.STATUS = STATUS -function M.new_response(this) +function Http.new_response(this) this = new_common(this) this.status = STATUS.OK if this.java ~= nil then @@ -112,16 +112,16 @@ this.send_error = this.java.sendError function this.set_cookie(name,value,is_persistent,domain) - HttpServicer.setCookie(M.request.java,this.java,name,value,is_persistent,domain) + HttpServicer.setCookie(Http.request.java,this.java,name,value,is_persistent,domain) end function this.remove_cookie(name,domain) - HttpServicer.removeCookie(M.request.java,this.java,name,domain) + HttpServicer.removeCookie(Http.request.java,this.java,name,domain) end function this.set() HttpServicer.setResponse(this,this.java) - M.sent_headers(this.headers) + Http.sent_headers(this.headers) end function this.text_writer() @@ -148,18 +148,18 @@ -- response = new_response{} -- filled in by HttpServicer -M.per_session_pages = {} +Http.per_session_pages = {} -function M.per_session(page) - M.per_session_pages[page] = true +function Http.per_session(page) + Http.per_session_pages[page] = true end -function M.clear_session() - M.request.java.getSession().removeAttribute("luan") +function Http.clear_session() + Http.request.java.getSession().removeAttribute("luan") end -function M.uncache_site() +function Http.uncache_site() for k in pairs(Table.copy(Package.loaded)) do if matches(k,"^site:") then Package.loaded[k] = nil @@ -167,6 +167,6 @@ end end -M.run_later = HttpServicer.run_later +Http.run_later = HttpServicer.run_later -return M +return Http