Mercurial Hosting > luan
comparison src/luan/modules/http/LuanDomainHandler.java @ 1332:11b7e11f9ed5
cleaner logging
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Feb 2019 21:50:26 -0700 |
parents | 5a39b006acd1 |
children | 25746915a241 |
comparison
equal
deleted
inserted
replaced
1331:02fe660e7748 | 1332:11b7e11f9ed5 |
---|---|
6 import luan.webserver.handlers.DomainHandler; | 6 import luan.webserver.handlers.DomainHandler; |
7 import luan.LuanState; | 7 import luan.LuanState; |
8 import luan.LuanTable; | 8 import luan.LuanTable; |
9 import luan.LuanCloner; | 9 import luan.LuanCloner; |
10 import luan.LuanException; | 10 import luan.LuanException; |
11 import luan.modules.logging.LuanLogger; | 11 import luan.modules.logging.Log4j; |
12 | 12 |
13 | 13 |
14 public class LuanDomainHandler implements Handler, DomainHandler.Factory { | 14 public class LuanDomainHandler implements Handler, DomainHandler.Factory { |
15 | 15 |
16 private final LuanState luanInit; | 16 private final LuanState luanInit; |
24 @Override public Handler newHandler(String domain) { | 24 @Override public Handler newHandler(String domain) { |
25 LuanState luan = newLuan(domain); | 25 LuanState luan = newLuan(domain); |
26 return new LuanHandler(luan); | 26 return new LuanHandler(luan); |
27 } | 27 } |
28 | 28 |
29 protected void newLoggerRepository(LuanState luan) throws LuanException { | |
30 Log4j.newLoggerRepository(luan); | |
31 } | |
32 | |
29 protected LuanState newLuan(String domain) { | 33 protected LuanState newLuan(String domain) { |
30 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); | 34 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); |
31 LuanState luan = (LuanState)cloner.clone(luanInit); | 35 LuanState luan = (LuanState)cloner.clone(luanInit); |
32 try { | 36 try { |
33 LuanLogger.newLoggerRepository(luan); | 37 newLoggerRepository(luan); |
34 LuanTable Http = (LuanTable)luan.require("luan:http/Http.luan"); | 38 LuanTable Http = (LuanTable)luan.require("luan:http/Http.luan"); |
35 Http.put( "domain", domain ); | 39 Http.put( "domain", domain ); |
36 } catch(LuanException e) { | 40 } catch(LuanException e) { |
37 throw new RuntimeException(e); | 41 throw new RuntimeException(e); |
38 } | 42 } |