changeset 609:24b05963ba62

shell "clear" button now clears the session
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 09 Dec 2015 18:12:16 -0700
parents d2e0855b3105
children b4f3dbe1c6e3
files http/src/luan/modules/http/Http.luan http/src/luan/modules/http/Shell_mod.luan
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
diff -r d2e0855b3105 -r 24b05963ba62 http/src/luan/modules/http/Http.luan
--- a/http/src/luan/modules/http/Http.luan	Mon Dec 07 16:04:01 2015 -0700
+++ b/http/src/luan/modules/http/Http.luan	Wed Dec 09 18:12:16 2015 -0700
@@ -151,6 +151,10 @@
 	M.per_session_pages[page] = true
 end
 
+function M.clear_session()
+	M.request.java.getSession().removeAttribute("luan")
+end
+
 
 function M.uncache_site()
 	for k in pairs(Table.copy(Package.loaded)) do
diff -r d2e0855b3105 -r 24b05963ba62 http/src/luan/modules/http/Shell_mod.luan
--- a/http/src/luan/modules/http/Shell_mod.luan	Mon Dec 07 16:04:01 2015 -0700
+++ b/http/src/luan/modules/http/Shell_mod.luan	Wed Dec 09 18:12:16 2015 -0700
@@ -15,7 +15,9 @@
 
 function M.respond()
 	if Http.request.parameter.clear ~= nil then
-		history = {}
+		Http.clear_session()
+		Http.response.send_redirect(Http.request.path)  -- reload page
+		return
 	else
 		local cmd = Http.request.parameter.cmd
 		if cmd ~= nil then