comparison src/luan/modules/http/LuanDomainHandler.java @ 1321:307e76ccd0d6

generalize separate logging
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 05 Feb 2019 22:36:55 -0700
parents 5763597ca5c0
children 55b8210b4ec0
comparison
equal deleted inserted replaced
1320:2c8d1d76a82a 1321:307e76ccd0d6
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 12
12 13
13 public final class LuanDomainHandler implements Handler { 14 public final class LuanDomainHandler implements Handler {
14 15
15 private final LuanState luanInit; 16 private final LuanState luanInit;
17 private final DomainHandler.Factory factory = new DomainHandler.Factory() { 18 private final DomainHandler.Factory factory = new DomainHandler.Factory() {
18 public Handler newHandler(String domain) { 19 public Handler newHandler(String domain) {
19 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); 20 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE);
20 LuanState luan = (LuanState)cloner.clone(luanInit); 21 LuanState luan = (LuanState)cloner.clone(luanInit);
21 try { 22 try {
23 LuanLogger.newLoggerRepository(luan);
22 LuanTable Http = (LuanTable)luan.require("luan:http/Http.luan"); 24 LuanTable Http = (LuanTable)luan.require("luan:http/Http.luan");
23 Http.put( "domain", domain ); 25 Http.put( "domain", domain );
24 } catch(LuanException e) { 26 } catch(LuanException e) {
25 throw new RuntimeException(e); 27 throw new RuntimeException(e);
26 } 28 }
27 return new LuanHandler(luan,null); 29 return new LuanHandler(luan);
28 } 30 }
29 }; 31 };
30 32
31 private final DomainHandler domainHandler = new DomainHandler(factory); 33 private final DomainHandler domainHandler = new DomainHandler(factory);
32 34