From cb0084260fcda4f910a7e474886b299cc5c16661 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 4 Jul 2013 15:22:56 +1000 Subject: [PATCH] 411216 RequestLogHandler handles async completion --- .../server/handler/RequestLogHandler.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/RequestLogHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/RequestLogHandler.java index db13f565641..426aaded707 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/RequestLogHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/RequestLogHandler.java @@ -32,6 +32,7 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.RequestLog; import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -154,7 +155,10 @@ public class RequestLogHandler extends HandlerWrapper protected void doStart() throws Exception { if (_requestLog==null) - throw new IllegalStateException("!RequestLog"); + { + LOG.warn("!RequestLog"); + _requestLog=new NullRequestLog(); + } super.doStart(); _requestLog.start(); } @@ -168,6 +172,18 @@ public class RequestLogHandler extends HandlerWrapper { super.doStop(); _requestLog.stop(); + if (_requestLog instanceof NullRequestLog) + _requestLog=null; + } + + /* ------------------------------------------------------------ */ + /* ------------------------------------------------------------ */ + /* ------------------------------------------------------------ */ + private static class NullRequestLog extends AbstractLifeCycle implements RequestLog + { + public void log(Request request, Response response) + { + } } }