summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2023-10-05 17:17:19 +0200
committerGitHub <noreply@github.com>2023-10-05 17:17:19 +0200
commit9dfadb0aeb9c5925b14c7f4c63f04ddb3001f80f (patch)
tree566e9bc5cefba017c6f75f93742b245f34d4d49c /config-model
parent012d1de106579d71a9a6fe99efc6f657c06964cd (diff)
parent744789d5d603dc3dee201030def15033101f168d (diff)
Merge pull request #28808 from vespa-engine/jonmv/slimmer-jetty-server-component
Isolate inner jetty server component from wrapper with filters
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java11
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java20
2 files changed, 20 insertions, 11 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
index 0388230fa6a..1ab01839ef1 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
@@ -32,9 +32,11 @@ public class JettyHttpServer extends SimpleComponent implements ServerConfig.Pro
super(new ComponentModel(componentId, com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName(), null));
this.isHostedVespa = deployState.isHosted();
this.cluster = cluster;
- final FilterBindingsProviderComponent filterBindingsProviderComponent = new FilterBindingsProviderComponent(componentId);
+ FilterBindingsProviderComponent filterBindingsProviderComponent = new FilterBindingsProviderComponent(componentId);
addChild(filterBindingsProviderComponent);
- inject(filterBindingsProviderComponent);
+ addChild(new SimpleComponent(childComponentModel(componentId, com.yahoo.jdisc.http.server.jetty.JettyHttpServerContext.class.getName())) {
+ { inject(filterBindingsProviderComponent); }
+ });
for (String agent : deployState.featureFlags().ignoredHttpUserAgents()) {
addIgnoredUserAgent(agent);
}
@@ -79,7 +81,7 @@ public class JettyHttpServer extends SimpleComponent implements ServerConfig.Pro
}
}
- static ComponentModel providerComponentModel(String parentId, String className) {
+ static ComponentModel childComponentModel(String parentId, String className) {
final ComponentSpecification classNameSpec = new ComponentSpecification(
className);
return new ComponentModel(new BundleInstantiationSpecification(
@@ -90,9 +92,8 @@ public class JettyHttpServer extends SimpleComponent implements ServerConfig.Pro
public static final class FilterBindingsProviderComponent extends SimpleComponent {
public FilterBindingsProviderComponent(String parentId) {
- super(providerComponentModel(parentId, "com.yahoo.container.jdisc.FilterBindingsProvider"));
+ super(childComponentModel(parentId, "com.yahoo.container.jdisc.FilterBindingsProvider"));
}
-
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java
index 89cce7feacb..5da5930515c 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java
@@ -77,23 +77,27 @@ public class JettyContainerModelBuilderTest extends ContainerModelBuilderTestBas
}
@Test
- void verifyThatJettyHttpServerHasFilterBindingsProvider() {
+ void verifyThatJettyHttpServerContextHasFilterBindingsProvider() {
final Element clusterElem = DomBuilderTest.parse(
"<container id='default' version='1.0'>",
nodesXml,
"</container>");
createModel(root, clusterElem);
- final ComponentsConfig.Components jettyHttpServerComponent = extractComponentByClassName(
+ ComponentsConfig.Components jettyHttpServerComponent = extractComponentByClassName(
containerComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName());
assertNotNull(jettyHttpServerComponent);
- final ComponentsConfig.Components filterBindingsProviderComponent = extractComponentByClassName(
+ ComponentsConfig.Components jettyHttpServerContextComponent = extractComponentByClassName(
+ containerComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServerContext.class.getName());
+ assertNotNull(jettyHttpServerContextComponent);
+
+ ComponentsConfig.Components filterBindingsProviderComponent = extractComponentByClassName(
containerComponentsConfig(), FilterBindingsProvider.class.getName());
assertNotNull(filterBindingsProviderComponent);
- final ComponentsConfig.Components.Inject filterBindingsProviderInjection = extractInjectionById(
- jettyHttpServerComponent, filterBindingsProviderComponent.id());
+ ComponentsConfig.Components.Inject filterBindingsProviderInjection = extractInjectionById(
+ jettyHttpServerContextComponent, filterBindingsProviderComponent.id());
assertNotNull(filterBindingsProviderInjection);
}
@@ -112,12 +116,16 @@ public class JettyContainerModelBuilderTest extends ContainerModelBuilderTestBas
clusterComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName());
assertNotNull(jettyHttpServerComponent);
+ final ComponentsConfig.Components jettyHttpServerContextComponent = extractComponentByClassName(
+ clusterComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServerContext.class.getName());
+ assertNotNull(jettyHttpServerContextComponent);
+
final ComponentsConfig.Components filterBindingsProviderComponent = extractComponentByClassName(
clusterComponentsConfig(), FilterBindingsProvider.class.getName());
assertNotNull(filterBindingsProviderComponent);
final ComponentsConfig.Components.Inject filterBindingsProviderInjection = extractInjectionById(
- jettyHttpServerComponent, filterBindingsProviderComponent.id());
+ jettyHttpServerContextComponent, filterBindingsProviderComponent.id());
assertNotNull(filterBindingsProviderInjection);
}