comparison src/luan/modules/http/LuanHandler.java @ 1580:2975c932864d

require options
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 10 Feb 2021 23:56:59 -0700
parents c922446f53aa
children 9303bacae890
comparison
equal deleted inserted replaced
1579:dd881eb03d87 1580:2975c932864d
88 synchronized(luanInit) { 88 synchronized(luanInit) {
89 luan = new Luan(luanInit); 89 luan = new Luan(luanInit);
90 } 90 }
91 LuanLogger.startThreadLogging(luan); 91 LuanLogger.startThreadLogging(luan);
92 try { 92 try {
93 PackageLuan.load(luan,"site:/init.luan"); 93 PackageLuan.load(luan,"site:/init.luan",null);
94 } catch(LuanException e) { 94 } catch(LuanException e) {
95 //e.printStackTrace(); 95 //e.printStackTrace();
96 String err = e.getLuanStackTraceString(); 96 String err = e.getLuanStackTraceString();
97 logger.error(err); 97 logger.error(err);
98 } finally { 98 } finally {
257 String modName = "site:" + request.path +".luan"; 257 String modName = "site:" + request.path +".luan";
258 LuanFunction fn; 258 LuanFunction fn;
259 Luan luan; 259 Luan luan;
260 synchronized(currentLuan) { 260 synchronized(currentLuan) {
261 currentLuan.require("luan:http/Http.luan"); 261 currentLuan.require("luan:http/Http.luan");
262 Object mod = PackageLuan.load(currentLuan,modName); 262 Object mod = PackageLuan.load(currentLuan,modName,null);
263 if( mod.equals(Boolean.FALSE) ) 263 if( mod.equals(Boolean.FALSE) )
264 return null; 264 return null;
265 if( !(mod instanceof LuanFunction) ) 265 if( !(mod instanceof LuanFunction) )
266 throw new LuanException( "module '"+modName+"' must return a function" ); 266 throw new LuanException( "module '"+modName+"' must return a function" );
267 luan = new Luan(currentLuan); 267 luan = new Luan(currentLuan);