aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/jdisc/http/server
diff options
context:
space:
mode:
Diffstat (limited to 'container-core/src/main/java/com/yahoo/jdisc/http/server')
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLogRequestLog.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLoggingRequestHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CapabilityEnforcingRequestHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlerUtils.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlers.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorSpecificContextHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/DataplaneProxyCredentials.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ErrorResponseContentCreator.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ExceptionWrapper.java4
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterBindings.java16
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterResolver.java8
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilteringRequestHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FormPostRequestHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java22
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscContext.java32
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscHttpServlet.java14
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscServerConnector.java8
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/Janitor.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java38
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServerContext.java38
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/MetricDefinitions.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ReferenceCountingRequestHandler.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestException.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestMetricReporter.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestUtils.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ResponseMetricAggregator.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServerMetricReporter.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletOutputStreamWriter.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletRequestReader.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletResponseController.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SimpleConcurrentIdentityHashMap.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailedListener.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailure.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/TlsClientAuthenticationEnforcer.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidConnectionLog.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidRequestLog.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/package-info.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/ConnectorFactoryRegistryModule.java2
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/TestDriver.java10
45 files changed, 161 insertions, 99 deletions
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLogRequestLog.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLogRequestLog.java
index 7a305c23ba3..ccb41ca3055 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLogRequestLog.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLogRequestLog.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.google.common.base.Objects;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLoggingRequestHandler.java
index f79bfd9c577..2c9cffa6786 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLoggingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/AccessLoggingRequestHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.google.common.base.Preconditions;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CapabilityEnforcingRequestHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CapabilityEnforcingRequestHandler.java
index dde864704cb..97dae91dd68 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CapabilityEnforcingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CapabilityEnforcingRequestHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlerUtils.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlerUtils.java
index 06f29f31583..c6e20245be1 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlerUtils.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlerUtils.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.handler.CompletionHandler;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlers.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlers.java
index 1063c70fe0f..caa942b6a5c 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlers.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/CompletionHandlers.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.handler.CompletionHandler;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java
index a215d6b4e17..79ed382fab8 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java
index 06a9986e996..4a4f1188eb1 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.http.ConnectorConfig;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
index f2118008af3..90f770e1494 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.component.annotation.Inject;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorSpecificContextHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorSpecificContextHandler.java
index 3554d371cf8..ef4a5bb5067 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorSpecificContextHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorSpecificContextHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import org.eclipse.jetty.server.Request;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/DataplaneProxyCredentials.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/DataplaneProxyCredentials.java
index 05c6f5be467..b2afd73bc80 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/DataplaneProxyCredentials.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/DataplaneProxyCredentials.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.component.AbstractComponent;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ErrorResponseContentCreator.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ErrorResponseContentCreator.java
index 53c9fbbdb50..33330bea70b 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ErrorResponseContentCreator.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ErrorResponseContentCreator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import org.eclipse.jetty.util.ByteArrayISO8859Writer;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ExceptionWrapper.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ExceptionWrapper.java
index 3ba159e5ef6..75b07678d5b 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ExceptionWrapper.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ExceptionWrapper.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
/**
@@ -7,7 +7,7 @@ package com.yahoo.jdisc.http.server.jetty;
* ensures some extra information is automatically added to the contents of
* getMessage().
*
- * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
+ * @author Steinar Knutsen
*/
public class ExceptionWrapper extends RuntimeException {
private final String message;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterBindings.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterBindings.java
index e4e8188dc41..d86d0cc4af1 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterBindings.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterBindings.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.application.BindingRepository;
@@ -27,20 +27,22 @@ public class FilterBindings {
private final Map<Integer, String> defaultResponseFilters;
private final BindingSet<String> requestFilterBindings;
private final BindingSet<String> responseFilterBindings;
-
+ private final boolean strictFiltering;
private FilterBindings(
Map<String, RequestFilter> requestFilters,
Map<String, ResponseFilter> responseFilters,
Map<Integer, String> defaultRequestFilters,
Map<Integer, String> defaultResponseFilters,
BindingSet<String> requestFilterBindings,
- BindingSet<String> responseFilterBindings) {
+ BindingSet<String> responseFilterBindings,
+ boolean strictFiltering) {
this.requestFilters = requestFilters;
this.responseFilters = responseFilters;
this.defaultRequestFilters = defaultRequestFilters;
this.defaultResponseFilters = defaultResponseFilters;
this.requestFilterBindings = requestFilterBindings;
this.responseFilterBindings = responseFilterBindings;
+ this.strictFiltering = strictFiltering;
}
public Optional<String> resolveRequestFilter(URI uri, int localPort) {
@@ -67,6 +69,8 @@ public class FilterBindings {
public Collection<ResponseFilter> responseFilters() { return responseFilters.values(); }
+ public boolean strictFiltering() { return strictFiltering; }
+
public static class Builder {
private final Map<String, RequestFilter> requestFilters = new TreeMap<>();
private final Map<String, ResponseFilter> responseFilters = new TreeMap<>();
@@ -74,6 +78,7 @@ public class FilterBindings {
private final Map<Integer, String> defaultResponseFilters = new TreeMap<>();
private final BindingRepository<String> requestFilterBindings = new BindingRepository<>();
private final BindingRepository<String> responseFilterBindings = new BindingRepository<>();
+ private boolean strictFiltering = false;
public Builder() {}
@@ -89,6 +94,8 @@ public class FilterBindings {
public Builder setResponseFilterDefaultForPort(String id, int port) { defaultResponseFilters.put(port, id); return this; }
+ public Builder setStrictFiltering(boolean strictFiltering) { this.strictFiltering = strictFiltering; return this; }
+
public FilterBindings build() {
return new FilterBindings(
Collections.unmodifiableMap(requestFilters),
@@ -96,7 +103,8 @@ public class FilterBindings {
Collections.unmodifiableMap(defaultRequestFilters),
Collections.unmodifiableMap(defaultResponseFilters),
requestFilterBindings.activate(),
- responseFilterBindings.activate());
+ responseFilterBindings.activate(),
+ strictFiltering);
}
}
}
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterResolver.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterResolver.java
index 32def124131..96c69489d97 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterResolver.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilterResolver.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
@@ -27,12 +27,10 @@ class FilterResolver {
private final FilterBindings bindings;
private final Metric metric;
- private final boolean strictFiltering;
- FilterResolver(FilterBindings bindings, Metric metric, boolean strictFiltering) {
+ FilterResolver(FilterBindings bindings, Metric metric) {
this.bindings = bindings;
this.metric = metric;
- this.strictFiltering = strictFiltering;
}
Optional<RequestFilter> resolveRequestFilter(Request request, URI jdiscUri) {
@@ -40,7 +38,7 @@ class FilterResolver {
if (maybeFilterId.isPresent()) {
metric.add(MetricDefinitions.FILTERING_REQUEST_HANDLED, 1L, createMetricContext(request, maybeFilterId.get()));
request.setAttribute(RequestUtils.JDISC_REQUEST_CHAIN, maybeFilterId.get());
- } else if (!strictFiltering) {
+ } else if (!bindings.strictFiltering()) {
metric.add(MetricDefinitions.FILTERING_REQUEST_UNHANDLED, 1L, createMetricContext(request, null));
} else {
String syntheticFilterId = RejectingRequestFilter.SYNTHETIC_FILTER_CHAIN_ID;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilteringRequestHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilteringRequestHandler.java
index fe7b30ac7b3..1125f4e4825 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilteringRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FilteringRequestHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.google.common.base.Preconditions;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FormPostRequestHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FormPostRequestHandler.java
index d2dbfaa3514..c2b81530e82 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FormPostRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/FormPostRequestHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.google.common.base.Preconditions;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
index 342d7ab9c4a..c33a78bc4d2 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.concurrent.DaemonThreadFactory;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
index 6fdcc96bdc9..a2c2a5df4df 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.container.logging.AccessLogEntry;
@@ -54,19 +54,19 @@ class HttpRequestDispatch {
private final RequestMetricReporter metricReporter;
HttpRequestDispatch(JDiscContext jDiscContext,
- AccessLogEntry accessLogEntry,
- Context metricContext,
- HttpServletRequest servletRequest,
- HttpServletResponse servletResponse) throws IOException {
+ AccessLogEntry accessLogEntry,
+ Context metricContext,
+ HttpServletRequest servletRequest,
+ HttpServletResponse servletResponse) throws IOException {
this.jDiscContext = jDiscContext;
requestHandler = newRequestHandler(jDiscContext, accessLogEntry, servletRequest);
this.jettyRequest = (Request) servletRequest;
- this.metricReporter = new RequestMetricReporter(jDiscContext.metric, metricContext, jettyRequest.getTimeStamp());
+ this.metricReporter = new RequestMetricReporter(jDiscContext.metric(), metricContext, jettyRequest.getTimeStamp());
this.servletResponseController = new ServletResponseController(servletRequest,
servletResponse,
- jDiscContext.janitor,
+ jDiscContext.janitor(),
metricReporter,
jDiscContext.developerMode());
shutdownConnectionGracefullyIfThresholdReached(jettyRequest);
@@ -195,21 +195,21 @@ class HttpRequestDispatch {
@SuppressWarnings("try")
private ServletRequestReader handleRequest() throws IOException {
- HttpRequest jdiscRequest = HttpRequestFactory.newJDiscRequest(jDiscContext.container, jettyRequest);
+ HttpRequest jdiscRequest = HttpRequestFactory.newJDiscRequest(jDiscContext.container(), jettyRequest);
ContentChannel requestContentChannel;
try (ResourceReference ref = References.fromResource(jdiscRequest)) {
HttpRequestFactory.copyHeaders(jettyRequest, jdiscRequest);
requestContentChannel = requestHandler.handleRequest(jdiscRequest, servletResponseController.responseHandler());
}
- return new ServletRequestReader(jettyRequest, requestContentChannel, jDiscContext.janitor, metricReporter);
+ return new ServletRequestReader(jettyRequest, requestContentChannel, jDiscContext.janitor(), metricReporter);
}
private static RequestHandler newRequestHandler(JDiscContext context,
AccessLogEntry accessLogEntry,
HttpServletRequest servletRequest) {
RequestHandler requestHandler = wrapHandlerIfFormPost(
- new FilteringRequestHandler(context.filterResolver, (Request)servletRequest),
- servletRequest, context.serverConfig.removeRawPostBodyForWwwUrlEncodedPost());
+ new FilteringRequestHandler(context.filterResolver(), (Request)servletRequest),
+ servletRequest, context.removeRawPostBodyForWwwUrlEncodedPost());
return new AccessLoggingRequestHandler(requestHandler, accessLogEntry);
}
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java
index 8c8109fa518..aa5deab29cd 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.http.HttpRequest;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscContext.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscContext.java
index c80299b4737..12669c2e952 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscContext.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscContext.java
@@ -1,31 +1,21 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.http.ServerConfig;
import com.yahoo.jdisc.service.CurrentContainer;
-public class JDiscContext {
- final FilterResolver filterResolver;
- final CurrentContainer container;
- final Janitor janitor;
- final Metric metric;
- final ServerConfig serverConfig;
+record JDiscContext(FilterResolver filterResolver,
+ CurrentContainer container,
+ Janitor janitor,
+ Metric metric,
+ boolean developerMode,
+ boolean removeRawPostBodyForWwwUrlEncodedPost) {
- public JDiscContext(FilterBindings filterBindings,
- CurrentContainer container,
- Janitor janitor,
- Metric metric,
- ServerConfig serverConfig) {
-
- this.filterResolver = new FilterResolver(filterBindings, metric, serverConfig.strictFiltering());
- this.container = container;
- this.janitor = janitor;
- this.metric = metric;
- this.serverConfig = serverConfig;
+ public static JDiscContext of(FilterBindings filterBindings, CurrentContainer container,
+ Janitor janitor, Metric metric, ServerConfig config) {
+ return new JDiscContext(new FilterResolver(filterBindings, metric), container, janitor,
+ metric, config.developerMode(), config.removeRawPostBodyForWwwUrlEncodedPost());
}
- public boolean developerMode() {
- return serverConfig.developerMode();
- }
}
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscHttpServlet.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscHttpServlet.java
index bd052f14867..25de19da178 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscHttpServlet.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscHttpServlet.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.container.logging.AccessLogEntry;
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;
import java.util.Set;
+import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@@ -33,14 +34,15 @@ class JDiscHttpServlet extends HttpServlet {
public static final String ATTRIBUTE_NAME_ACCESS_LOG_ENTRY = JDiscHttpServlet.class.getName() + "_access-log-entry";
private final static Logger log = Logger.getLogger(JDiscHttpServlet.class.getName());
- private final JDiscContext context;
private static final Set<String> servletSupportedMethods =
Stream.of(Method.OPTIONS, Method.GET, Method.HEAD, Method.POST, Method.PUT, Method.DELETE, Method.TRACE)
.map(Method::name)
.collect(Collectors.toSet());
- public JDiscHttpServlet(JDiscContext context) {
+ private final Supplier<JDiscContext> context;
+
+ public JDiscHttpServlet(Supplier<JDiscContext> context) {
this.context = context;
}
@@ -89,8 +91,8 @@ class JDiscHttpServlet extends HttpServlet {
request.setAttribute(JDiscServerConnector.REQUEST_ATTRIBUTE, getConnector((Request) request));
Metric.Context metricContext = getMetricContext(request);
- context.metric.add(MetricDefinitions.NUM_REQUESTS, 1, metricContext);
- context.metric.add(MetricDefinitions.JDISC_HTTP_REQUESTS, 1, metricContext);
+ context.get().metric().add(MetricDefinitions.NUM_REQUESTS, 1, metricContext);
+ context.get().metric().add(MetricDefinitions.JDISC_HTTP_REQUESTS, 1, metricContext);
String method = request.getMethod().toUpperCase();
if (servletSupportedMethods.contains(method)) {
@@ -114,7 +116,7 @@ class JDiscHttpServlet extends HttpServlet {
try {
switch (request.getDispatcherType()) {
case REQUEST:
- new HttpRequestDispatch(context, accessLogEntry, metricContext, request, response).dispatchRequest();
+ new HttpRequestDispatch(context.get(), accessLogEntry, metricContext, request, response).dispatchRequest();
break;
default:
if (log.isLoggable(Level.INFO)) {
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscServerConnector.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscServerConnector.java
index b17877cee84..983adec034d 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscServerConnector.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JDiscServerConnector.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
@@ -11,8 +11,8 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Optional;
/**
* @author bjorncs
@@ -26,6 +26,7 @@ class JDiscServerConnector extends ServerConnector {
private final Metric metric;
private final String connectorName;
private final int listenPort;
+ private final List<String> knownServerNames;
JDiscServerConnector(ConnectorConfig config, Metric metric, Server server, JettyConnectionLogger connectionLogger,
ConnectionMetricAggregator connectionMetricAggregator, ConnectionFactory... factories) {
@@ -35,6 +36,7 @@ class JDiscServerConnector extends ServerConnector {
this.connectorName = config.name();
this.listenPort = config.listenPort();
this.metricCtx = metric.createContext(createConnectorDimensions(listenPort, connectorName, 0));
+ this.knownServerNames = List.copyOf(config.serverName().known());
this.statistics = new ConnectionStatistics();
setAcceptedTcpNoDelay(config.tcpNoDelay());
@@ -69,7 +71,7 @@ class JDiscServerConnector extends ServerConnector {
dimensions.put(MetricDefinitions.SCHEME_DIMENSION, scheme);
dimensions.put(MetricDefinitions.CLIENT_AUTHENTICATED_DIMENSION, Boolean.toString(clientAuthenticated));
dimensions.put(MetricDefinitions.PROTOCOL_DIMENSION, request.getProtocol());
- String serverName = Optional.ofNullable(request.getServerName()).orElse("unknown");
+ String serverName = knownServerNames.stream().filter(name -> name.equalsIgnoreCase(request.getServerName())).findFirst().orElse("unknown");
dimensions.put(MetricDefinitions.REQUEST_SERVER_NAME_DIMENSION, serverName);
dimensions.putAll(extraDimensions);
return metric.createContext(dimensions);
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/Janitor.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/Janitor.java
index 649f0908748..a927744ea0e 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/Janitor.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/Janitor.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.component.annotation.Inject;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
index 2ea3863cc5a..7b045b7fb08 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.container.logging.ConnectionLog;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
index 7d84ee6f8a3..1747541bef5 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
@@ -1,15 +1,17 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.google.inject.Inject;
import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.container.logging.ConnectionLog;
import com.yahoo.container.logging.RequestLog;
+import com.yahoo.jdisc.AbstractResource;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.http.ConnectorConfig;
import com.yahoo.jdisc.http.ServerConfig;
import com.yahoo.jdisc.service.AbstractServerProvider;
import com.yahoo.jdisc.service.CurrentContainer;
+import com.yahoo.jdisc.service.ServerProvider;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.jmx.ConnectorServer;
import org.eclipse.jetty.jmx.MBeanContainer;
@@ -36,7 +38,10 @@ import java.net.BindException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Deque;
import java.util.List;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@@ -45,27 +50,26 @@ import java.util.stream.Collectors;
* @author Simon Thoresen Hult
* @author bjorncs
*/
-public class JettyHttpServer extends AbstractServerProvider {
+public class JettyHttpServer extends AbstractResource implements ServerProvider {
private final static Logger log = Logger.getLogger(JettyHttpServer.class.getName());
+ private final ServerConfig config;
private final Server server;
private final List<Integer> listenedPorts = new ArrayList<>();
private final ServerMetricReporter metricsReporter;
+ private final Deque<JDiscContext> contexts = new ConcurrentLinkedDeque<>();
@Inject // ServerProvider implementors must use com.google.inject.Inject
- public JettyHttpServer(CurrentContainer container,
- Metric metric,
+ public JettyHttpServer(Metric metric,
ServerConfig serverConfig,
- FilterBindings filterBindings,
- Janitor janitor,
ComponentRegistry<ConnectorFactory> connectorFactories,
RequestLog requestLog,
ConnectionLog connectionLog) {
- super(container);
if (connectorFactories.allComponents().isEmpty())
throw new IllegalArgumentException("No connectors configured.");
+ this.config = serverConfig;
server = new Server();
server.setStopTimeout((long)(serverConfig.stopTimeout() * 1000.0));
server.setRequestLog(new AccessLogRequestLog(requestLog));
@@ -81,9 +85,7 @@ public class JettyHttpServer extends AbstractServerProvider {
}
server.addBeanToAllConnectors(new ResponseMetricAggregator(serverConfig.metric()));
- JDiscContext jDiscContext = new JDiscContext(filterBindings, container, janitor, metric, serverConfig);
-
- ServletHolder jdiscServlet = new ServletHolder(new JDiscHttpServlet(jDiscContext));
+ ServletHolder jdiscServlet = new ServletHolder(new JDiscHttpServlet(this::newestContext));
List<JDiscServerConnector> connectors = Arrays.stream(server.getConnectors())
.map(JDiscServerConnector.class::cast)
.toList();
@@ -91,6 +93,22 @@ public class JettyHttpServer extends AbstractServerProvider {
this.metricsReporter = new ServerMetricReporter(metric, server);
}
+ JDiscContext registerContext(FilterBindings filterBindings, CurrentContainer container, Janitor janitor, Metric metric) {
+ JDiscContext context = JDiscContext.of(filterBindings, container, janitor, metric, config);
+ contexts.addFirst(context);
+ return context;
+ }
+
+ void deregisterContext(JDiscContext context) {
+ contexts.remove(context);
+ }
+
+ JDiscContext newestContext() {
+ JDiscContext context = contexts.peekFirst();
+ if (context == null) throw new IllegalStateException("JettyHttpServer has no registered JDiscContext");
+ return context;
+ }
+
private static void setupJmx(Server server, ServerConfig serverConfig) {
if (serverConfig.jmx().enabled()) {
System.setProperty("java.rmi.server.hostname", "localhost");
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServerContext.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServerContext.java
new file mode 100644
index 00000000000..1f797169293
--- /dev/null
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServerContext.java
@@ -0,0 +1,38 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.jdisc.http.server.jetty;
+
+import com.google.inject.Inject;
+import com.yahoo.component.AbstractComponent;
+import com.yahoo.component.provider.ComponentRegistry;
+import com.yahoo.container.Container;
+import com.yahoo.container.logging.ConnectionLog;
+import com.yahoo.container.logging.RequestLog;
+import com.yahoo.jdisc.Metric;
+import com.yahoo.jdisc.http.ServerConfig;
+import com.yahoo.jdisc.service.CurrentContainer;
+
+/**
+ * @author jonmv
+ *
+ * Context that a {@link JettyHttpServer} uses to pass requests to JDisc.
+ * This registers itself with the server upon construction, and unregisters
+ * on deconstruction, and the server always uses the most recent context.
+ */
+public class JettyHttpServerContext extends AbstractComponent {
+
+ private final JDiscContext context;
+ private final JettyHttpServer server;
+
+ @Inject // Must use guice annotation due to setup in TestDriver
+ public JettyHttpServerContext(CurrentContainer container, Metric metric, FilterBindings filterBindings,
+ Janitor janitor, JettyHttpServer server) {
+ this.server = server;
+ this.context = server.registerContext(filterBindings, container, janitor, metric);
+ }
+
+ @Override
+ public void deconstruct() {
+ server.deregisterContext(context);
+ }
+
+}
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/MetricDefinitions.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/MetricDefinitions.java
index e4775fba46f..dd7c37b7adc 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/MetricDefinitions.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/MetricDefinitions.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import ai.vespa.metrics.ContainerMetrics;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ReferenceCountingRequestHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ReferenceCountingRequestHandler.java
index b5a72b60f1c..03abe0c818e 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ReferenceCountingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ReferenceCountingRequestHandler.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Request;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestException.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestException.java
index 0fdedfcf801..53ece5c0c0b 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestException.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestException.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
/**
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestMetricReporter.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestMetricReporter.java
index b3450e9e77e..aa9395a94ec 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestMetricReporter.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestMetricReporter.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestUtils.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestUtils.java
index 2769f1f6729..a8a8cab3f8a 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestUtils.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/RequestUtils.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import jakarta.servlet.http.HttpServletRequest;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ResponseMetricAggregator.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ResponseMetricAggregator.java
index 48823599608..36ca1a63753 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ResponseMetricAggregator.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ResponseMetricAggregator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServerMetricReporter.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServerMetricReporter.java
index d2f9de5ae28..72944ae98ab 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServerMetricReporter.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServerMetricReporter.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.concurrent.DaemonThreadFactory;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletOutputStreamWriter.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletOutputStreamWriter.java
index 97aea01b6ab..d8f8a5223cf 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletOutputStreamWriter.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletOutputStreamWriter.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.handler.CompletionHandler;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletRequestReader.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletRequestReader.java
index 75ef655c60c..0c498822ea9 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletRequestReader.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletRequestReader.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Response;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletResponseController.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletResponseController.java
index c423ceab2b9..9aa133310e9 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletResponseController.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ServletResponseController.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Response;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SimpleConcurrentIdentityHashMap.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SimpleConcurrentIdentityHashMap.java
index 86f8e858b5a..5d53933c367 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SimpleConcurrentIdentityHashMap.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SimpleConcurrentIdentityHashMap.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import java.util.Optional;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailedListener.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailedListener.java
index 817a99bb57f..2de9fdf7ad7 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailedListener.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailedListener.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Metric;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailure.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailure.java
index 0f4bb0b54af..471d10d7601 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailure.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeFailure.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import org.eclipse.jetty.io.EofException;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/TlsClientAuthenticationEnforcer.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/TlsClientAuthenticationEnforcer.java
index 96f0cdebd62..501027298b0 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/TlsClientAuthenticationEnforcer.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/TlsClientAuthenticationEnforcer.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.jdisc.Response;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidConnectionLog.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidConnectionLog.java
index 8e638749e05..05d8287caa1 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidConnectionLog.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidConnectionLog.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidRequestLog.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidRequestLog.java
index dba62d8b3b9..797c8b08e9a 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidRequestLog.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/VoidRequestLog.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
import com.yahoo.container.logging.RequestLog;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/package-info.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/package-info.java
index 3665b8961c0..e7dd3ae295d 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/package-info.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/package-info.java
@@ -1,3 +1,3 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
@com.yahoo.osgi.annotation.ExportPackage
package com.yahoo.jdisc.http.server.jetty;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/ConnectorFactoryRegistryModule.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/ConnectorFactoryRegistryModule.java
index a0154da154d..d98676696c3 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/ConnectorFactoryRegistryModule.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/ConnectorFactoryRegistryModule.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty.testutils;
import com.google.inject.Binder;
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/TestDriver.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/TestDriver.java
index ec0258e8763..501b0fb13f9 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/TestDriver.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/testutils/TestDriver.java
@@ -1,8 +1,9 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty.testutils;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
+import com.google.inject.Singleton;
import com.google.inject.util.Modules;
import com.yahoo.container.logging.ConnectionLog;
import com.yahoo.container.logging.RequestLog;
@@ -12,6 +13,7 @@ import com.yahoo.jdisc.http.ConnectorConfig;
import com.yahoo.jdisc.http.ServerConfig;
import com.yahoo.jdisc.http.server.jetty.FilterBindings;
import com.yahoo.jdisc.http.server.jetty.JettyHttpServer;
+import com.yahoo.jdisc.http.server.jetty.JettyHttpServerContext;
import com.yahoo.jdisc.http.server.jetty.VoidConnectionLog;
import com.yahoo.jdisc.http.server.jetty.VoidRequestLog;
import com.yahoo.security.SslContextBuilder;
@@ -32,6 +34,7 @@ public class TestDriver implements AutoCloseable {
private final com.yahoo.jdisc.test.TestDriver jdiscCoreTestDriver;
private final JettyHttpServer server;
+ private final JettyHttpServerContext context;
private final SSLContext sslContext;
private TestDriver(Builder builder) {
@@ -46,6 +49,7 @@ public class TestDriver implements AutoCloseable {
com.yahoo.jdisc.test.TestDriver.newSimpleApplicationInstance(combinedModule);
ContainerBuilder containerBuilder = jdiscCoreTestDriver.newContainerBuilder();
JettyHttpServer server = containerBuilder.getInstance(JettyHttpServer.class);
+ this.context = containerBuilder.getInstance(JettyHttpServerContext.class);
containerBuilder.serverProviders().install(server);
builder.handlers.forEach((binding, handler) -> containerBuilder.serverBindings().bind(binding, handler));
jdiscCoreTestDriver.activateContainer(containerBuilder);
@@ -63,6 +67,7 @@ public class TestDriver implements AutoCloseable {
@Override public void close() { shutdown(); }
public boolean shutdown() {
+ context.deconstruct();
server.close();
server.release();
return jdiscCoreTestDriver.close();
@@ -83,9 +88,10 @@ public class TestDriver implements AutoCloseable {
new AbstractModule() {
@Override
protected void configure() {
+ bind(JettyHttpServer.class).in(Singleton.class);
bind(ServerConfig.class).toInstance(serverConfig);
bind(ConnectorConfig.class).toInstance(connectorConfig);
- bind(FilterBindings.class).toInstance(new FilterBindings.Builder().build());
+ bind(FilterBindings.class).toInstance(new FilterBindings.Builder().setStrictFiltering(serverConfig.strictFiltering()).build());
bind(ConnectionLog.class).toInstance(new VoidConnectionLog());
bind(RequestLog.class).toInstance(new VoidRequestLog());
}