All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.model.container.http.xml.JettyHttpServerBuilder Maven / Gradle / Ivy

There is a newer version: 8.409.18
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.http.xml;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AnyConfigProducer;
import com.yahoo.config.model.producer.TreeConfigProducer;
import com.yahoo.text.XML;
import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.http.ConnectorFactory;
import com.yahoo.vespa.model.container.http.JettyHttpServer;
import org.w3c.dom.Element;

/**
 * @author Einar M R Rosenvinge
 */
public class JettyHttpServerBuilder extends VespaDomBuilder.DomConfigProducerBuilderBase {

    private final ContainerCluster cluster;

    public JettyHttpServerBuilder(ContainerCluster cluster) {
        this.cluster = cluster;
    }

    @Override
    protected JettyHttpServer doBuild(DeployState deployState, TreeConfigProducer ancestor, Element http) {
        JettyHttpServer jettyHttpServer = new JettyHttpServer("jdisc-jetty", cluster, deployState);
        for (Element serverSpec: XML.getChildren(http, "server")) {
            ConnectorFactory connectorFactory = new JettyConnectorBuilder().build(deployState, ancestor, serverSpec);
            jettyHttpServer.addConnector(connectorFactory);
        }

        return jettyHttpServer;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy