Mercurial Hosting > luan
comparison src/luan/tools/WebShell.java @ 115:eacf6ce1b47d
add IoLib
git-svn-id: https://luan-java.googlecode.com/svn/trunk@116 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 29 May 2014 09:26:44 +0000 |
parents | 2428ecfed375 |
children | d00f41edbbd6 |
comparison
equal
deleted
inserted
replaced
114:c599206448b9 | 115:eacf6ce1b47d |
---|---|
18 import luan.LuanState; | 18 import luan.LuanState; |
19 import luan.LuanTable; | 19 import luan.LuanTable; |
20 import luan.LuanException; | 20 import luan.LuanException; |
21 import luan.lib.BasicLib; | 21 import luan.lib.BasicLib; |
22 import luan.lib.HtmlLib; | 22 import luan.lib.HtmlLib; |
23 import luan.lib.IoLib; | |
23 | 24 |
24 | 25 |
25 public class WebShell extends HttpServlet { | 26 public class WebShell extends HttpServlet { |
26 private static final Logger logger = LoggerFactory.getLogger(WebShell.class); | 27 private static final Logger logger = LoggerFactory.getLogger(WebShell.class); |
27 | 28 |
57 LuanState luan = (LuanState)session.getValue("luan"); | 58 LuanState luan = (LuanState)session.getValue("luan"); |
58 if( luan==null ) { | 59 if( luan==null ) { |
59 luan = newLuanState(); | 60 luan = newLuanState(); |
60 session.putValue("luan",luan); | 61 session.putValue("luan",luan); |
61 } | 62 } |
62 luan.out = new PrintStream(history); | 63 luan.set( "Io.stdout", IoLib.writer(new PrintStream(history)) ); |
63 LuanTable env = luan.global(); | 64 LuanTable env = luan.global(); |
64 env.put("request",request); | 65 env.put("request",request); |
65 env.put("response",response); | 66 env.put("response",response); |
66 Object[] result = eval(luan,cmd); | 67 Object[] result = eval(luan,cmd); |
67 if( result.length > 0 ) { | 68 if( result.length > 0 ) { |