Mercurial Hosting > luan
comparison src/luan/modules/http/LuanDomainHandler.java @ 1751:357daf580951
LuanDomainHandler domain check
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 24 Jan 2023 16:30:29 -0700 |
parents | 46cf5137cb6b |
children |
comparison
equal
deleted
inserted
replaced
1750:c7b3c327248a | 1751:357daf580951 |
---|---|
22 this.init = init; | 22 this.init = init; |
23 } | 23 } |
24 | 24 |
25 @Override public Handler newHandler(String domain) { | 25 @Override public Handler newHandler(String domain) { |
26 Luan luan = newLuan(domain); | 26 Luan luan = newLuan(domain); |
27 return new LuanHandler(luan,domain); | 27 return luan==null ? null : new LuanHandler(luan,domain); |
28 } | 28 } |
29 | 29 |
30 protected Luan newLuan(final String domain) { | 30 protected Luan newLuan(final String domain) { |
31 try { | 31 try { |
32 Luan luan = new Luan(); | 32 Luan luan = new Luan(); |
33 init.call(luan); | 33 Object rtn = init.call(luan,domain); |
34 if( !(rtn instanceof Boolean) ) | |
35 throw new LuanException("init must return boolean"); | |
36 if( !(Boolean)rtn ) | |
37 return null; | |
34 LuanFunction reset_luan = new LuanFunction() { | 38 LuanFunction reset_luan = new LuanFunction() { |
35 @Override public Object call(Luan luan,Object[] args) { | 39 @Override public Object call(Luan luan,Object[] args) { |
36 domainHandler.removeHandler(domain); | 40 domainHandler.removeHandler(domain); |
37 return LuanFunction.NOTHING; | 41 return LuanFunction.NOTHING; |
38 } | 42 } |