Mercurial Hosting > luan
comparison src/luan/tools/WebShell.java @ 52:0c0f2b107099
add WebRun
git-svn-id: https://luan-java.googlecode.com/svn/trunk@53 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 31 Dec 2012 03:15:20 +0000 |
parents | 28dfd91a816c |
children | 5c9cadd0acce |
comparison
equal
deleted
inserted
replaced
51:28dfd91a816c | 52:0c0f2b107099 |
---|---|
16 import luan.LuanFunction; | 16 import luan.LuanFunction; |
17 import luan.LuanState; | 17 import luan.LuanState; |
18 import luan.LuanException; | 18 import luan.LuanException; |
19 import luan.interp.LuanCompiler; | 19 import luan.interp.LuanCompiler; |
20 import luan.lib.BasicLib; | 20 import luan.lib.BasicLib; |
21 import luan.lib.JavaLib; | |
22 import luan.lib.StringLib; | |
23 import luan.lib.TableLib; | |
24 import luan.lib.HtmlLib; | 21 import luan.lib.HtmlLib; |
25 | 22 |
26 | 23 |
27 public class WebShell extends HttpServlet { | 24 public class WebShell extends HttpServlet { |
28 private static final Logger logger = LoggerFactory.getLogger(WebShell.class); | 25 private static final Logger logger = LoggerFactory.getLogger(WebShell.class); |
29 | 26 |
30 protected LuanState newLuanState() throws LuanException { | 27 protected LuanState newLuanState() throws LuanException { |
31 LuanState luan = LuanCompiler.newLuanState(); | 28 return CmdLine.newStandardLuan(); |
32 BasicLib.register(luan); | |
33 JavaLib.register(luan); | |
34 StringLib.register(luan); | |
35 TableLib.register(luan); | |
36 HtmlLib.register(luan); | |
37 return luan; | |
38 } | 29 } |
39 | 30 |
40 protected Object[] eval(LuanState luan,String cmd) throws LuanException { | 31 protected Object[] eval(LuanState luan,String cmd) throws LuanException { |
41 LuanFunction fn = BasicLib.load(luan,cmd,"WebShell"); | 32 return CmdLine.eval(luan,cmd,"WebShell"); |
42 return luan.call(fn,null,null); | |
43 } | 33 } |
44 | 34 |
45 protected void service(HttpServletRequest request,HttpServletResponse response) | 35 protected void service(HttpServletRequest request,HttpServletResponse response) |
46 throws ServletException, IOException | 36 throws ServletException, IOException |
47 { | 37 { |