Mercurial Hosting > luan
comparison src/luan/modules/http/LuanDomainHandler.java @ 1328:55b8210b4ec0
add MDC host
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 09 Feb 2019 21:49:42 -0700 |
parents | 307e76ccd0d6 |
children | 5a39b006acd1 |
comparison
equal
deleted
inserted
replaced
1327:b29eefad2111 | 1328:55b8210b4ec0 |
---|---|
1 package luan.modules.http; | 1 package luan.modules.http; |
2 | 2 |
3 import org.apache.log4j.MDC; | |
3 import luan.webserver.Request; | 4 import luan.webserver.Request; |
4 import luan.webserver.Response; | 5 import luan.webserver.Response; |
5 import luan.webserver.Handler; | 6 import luan.webserver.Handler; |
6 import luan.webserver.handlers.DomainHandler; | 7 import luan.webserver.handlers.DomainHandler; |
7 import luan.LuanState; | 8 import luan.LuanState; |
36 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); | 37 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); |
37 this.luanInit = (LuanState)cloner.clone(luanInit); | 38 this.luanInit = (LuanState)cloner.clone(luanInit); |
38 } | 39 } |
39 | 40 |
40 @Override public Response handle(Request request) { | 41 @Override public Response handle(Request request) { |
41 return domainHandler.handle(request); | 42 String host = (String)request.headers.get("host"); |
43 MDC.put("host",host); | |
44 try { | |
45 return domainHandler.handle(request); | |
46 } finally { | |
47 MDC.remove("host"); | |
48 } | |
42 } | 49 } |
43 } | 50 } |