Mercurial Hosting > luan
diff src/luan/modules/http/LuanDomainHandler.java @ 1350:d8754a50adf1
better reset_luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Mar 2019 09:41:50 -0700 |
parents | 643cf1c37723 |
children | 221eedb0f54e |
line wrap: on
line diff
--- a/src/luan/modules/http/LuanDomainHandler.java Wed Feb 27 12:30:46 2019 -0700 +++ b/src/luan/modules/http/LuanDomainHandler.java Mon Mar 04 09:41:50 2019 -0700 @@ -7,6 +7,7 @@ import luan.Luan; import luan.LuanTable; import luan.LuanCloner; +import luan.LuanFunction; import luan.LuanException; import luan.modules.logging.Log4j; @@ -30,13 +31,20 @@ Log4j.newLoggerRepository(luan); } - protected Luan newLuan(String domain) { + protected Luan newLuan(final String domain) { LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); Luan luan = (Luan)cloner.clone(luanInit); newLoggerRepository(luan); + LuanFunction reset_luan = new LuanFunction(false) { + @Override public Object call(Object[] args) { + domainHandler.removeHandler(domain); + return LuanFunction.NOTHING; + } + }; try { LuanTable Http = (LuanTable)luan.require("luan:http/Http.luan"); Http.put( "domain", domain ); + Http.put( "reset_luan", reset_luan ); } catch(LuanException e) { throw new RuntimeException(e); }