From a900010f81eb935b2e9ccb395d5d43e7a4705070 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 6 Aug 2013 09:14:28 +1000 Subject: [PATCH] 414235 RequestLogHandler configured on a context fails to handle forwarded requests --- .../jetty/server/handler/RequestLogHandler.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 727f474c711..bad2be3b148 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 @@ -22,6 +22,7 @@ import java.io.IOException; import javax.servlet.AsyncEvent; import javax.servlet.AsyncListener; +import javax.servlet.DispatcherType; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -92,13 +93,16 @@ public class RequestLogHandler extends HandlerWrapper } finally { - if (baseRequest.getHttpChannelState().isAsync()) + if (_requestLog != null && baseRequest.getDispatcherType().equals(DispatcherType.REQUEST)) { - if (baseRequest.getHttpChannelState().isInitial()) - baseRequest.getAsyncContext().addListener(_listener); + if (baseRequest.getHttpChannelState().isAsync()) + { + if (baseRequest.getHttpChannelState().isInitial()) + baseRequest.getAsyncContext().addListener(_listener); + } + else + _requestLog.log(baseRequest, (Response)response); } - else - _requestLog.log(baseRequest, (Response)response); } }