aboutsummaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2019-12-13 11:38:46 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2019-12-13 11:38:46 +0100
commit2730ee3558a30be3b8d4efb378dab583677baab0 (patch)
treedd99867dd06a86af69c1fecb0fe1f0c5a125a8a9 /container-core
parentca585ef51aa1ffbe3510f44274dd4922713955dc (diff)
Remove TODO and refactor control flow
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java40
1 files changed, 18 insertions, 22 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
index 488ce344f4a..62dc81aa103 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
@@ -246,31 +246,27 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
Optional<AccessLogEntry> jdiscRequestAccessLogEntry =
AccessLoggingRequestHandler.getAccessLogEntry(jdiscRequest);
-
+ AccessLogEntry entry;
if (jdiscRequestAccessLogEntry.isPresent()) {
- // This means we are running with Jetty, not Netty.
+ // The request is created by JDisc http layer (Jetty)
// Actual logging will be done by the Jetty integration; here, we just need to populate.
- httpResponse.populateAccessLogEntry(jdiscRequestAccessLogEntry.get());
- return;
+ entry = jdiscRequestAccessLogEntry.get();
+ } else {
+ // Not running on JDisc http layer (Jetty), e.g unit tests
+ AccessLogEntry accessLogEntry = new AccessLogEntry();
+ populateAccessLogEntryNotCreatedByHttpServer(
+ accessLogEntry,
+ jdiscRequest,
+ extendedResponse.getTiming(),
+ httpRequest.getUri().toString(),
+ commitStartTime,
+ startTime,
+ rendererWiring.written(),
+ httpResponse.getStatus());
+ accessLog.log(accessLogEntry);
+ entry = accessLogEntry;
}
-
- // We are running without Jetty. No access logging will be done at container level, so we do it here.
- // TODO: Remove when netty support is removed.
-
- AccessLogEntry accessLogEntry = new AccessLogEntry();
-
- populateAccessLogEntryNotCreatedByHttpServer(
- accessLogEntry,
- jdiscRequest,
- extendedResponse.getTiming(),
- httpRequest.getUri().toString(),
- commitStartTime,
- startTime,
- rendererWiring.written(),
- httpResponse.getStatus());
- httpResponse.populateAccessLogEntry(accessLogEntry);
-
- accessLog.log(accessLogEntry);
+ httpResponse.populateAccessLogEntry(entry);
}
private String getUri(com.yahoo.jdisc.http.HttpRequest jdiscRequest) {