Mercurial Hosting > luan
comparison src/luan/tools/WebServlet.java @ 84:cca4f8522893
minor changes
git-svn-id: https://luan-java.googlecode.com/svn/trunk@85 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 18 Feb 2013 23:15:14 +0000 |
parents | 9df729fa4419 |
children | 6db8f286fa6c |
comparison
equal
deleted
inserted
replaced
83:b84f66704026 | 84:cca4f8522893 |
---|---|
26 public static final String HTTP_SERVER = "http_server"; | 26 public static final String HTTP_SERVER = "http_server"; |
27 | 27 |
28 protected LuanState luanState = null; | 28 protected LuanState luanState = null; |
29 | 29 |
30 protected void loadLibs(LuanState luan) throws LuanException { | 30 protected void loadLibs(LuanState luan) throws LuanException { |
31 luan.load(BasicLib.LOADER,BasicLib.NAME); | 31 luan.load(BasicLib.NAME,BasicLib.LOADER); |
32 luan.load(PackageLib.LOADER,PackageLib.NAME); | 32 luan.load(PackageLib.NAME,PackageLib.LOADER); |
33 luan.load(MathLib.LOADER,MathLib.NAME); | 33 luan.load(MathLib.NAME,MathLib.LOADER); |
34 luan.load(StringLib.LOADER,StringLib.NAME); | 34 luan.load(StringLib.NAME,StringLib.LOADER); |
35 luan.load(TableLib.LOADER,TableLib.NAME); | 35 luan.load(TableLib.NAME,TableLib.LOADER); |
36 luan.load(HtmlLib.LOADER,HtmlLib.NAME); | 36 luan.load(HtmlLib.NAME,HtmlLib.LOADER); |
37 } | |
38 | |
39 protected void loadLuan(LuanState luan) throws LuanException { | |
40 PackageLib.require(luan,HTTP_SERVER); | |
41 Object fn = luan.global().get(HttpLib.FN_NAME); | |
42 if( !(fn instanceof LuanFunction) ) | |
43 throw new LuanException( luan, LuanElement.JAVA, "function '"+HttpLib.FN_NAME+"' not defined" ); | |
44 } | 37 } |
45 | 38 |
46 protected LuanState newLuanState() throws LuanException { | 39 protected LuanState newLuanState() throws LuanException { |
47 LuanState luan = LuanCompiler.newLuanState(); | 40 LuanState luan = LuanCompiler.newLuanState(); |
48 loadLibs(luan); | 41 loadLibs(luan); |
49 loadLuan(luan); | 42 PackageLib.require(luan,HTTP_SERVER); |
43 Object fn = luan.global().get(HttpLib.FN_NAME); | |
44 if( !(fn instanceof LuanFunction) ) | |
45 throw new LuanException( luan, LuanElement.JAVA, "function '"+HttpLib.FN_NAME+"' not defined" ); | |
50 return luan; | 46 return luan; |
51 } | 47 } |
52 | 48 |
53 protected LuanState getLuanState(HttpServletRequest request) throws LuanException { | 49 protected LuanState getLuanState(HttpServletRequest request) throws LuanException { |
54 synchronized(this) { | 50 synchronized(this) { |