Search in sources :

Example 1 with ConnectorFactory

use of com.yahoo.vespa.model.container.http.ConnectorFactory in project vespa by vespa-engine.

the class JettyConnectorBuilder method doBuild.

@Override
protected ConnectorFactory doBuild(AbstractConfigProducer ancestor, Element serverSpec) {
    String name = XmlHelper.getIdString(serverSpec);
    int port = HttpBuilder.readPort(serverSpec, ancestor.getRoot().getDeployState());
    Element legacyServerConfig = XML.getChild(serverSpec, "config");
    if (legacyServerConfig != null) {
        String configName = legacyServerConfig.getAttribute("name");
        if (configName.equals("container.jdisc.config.http-server")) {
            ancestor.deployLogger().log(Level.WARNING, "The config 'container.jdisc.config.http-server' is deprecated and will be removed in a later version of Vespa." + " Please use 'jdisc.http.connector' instead, see http://docs.vespa.ai/documentation/jdisc/http-server-and-filters.html#configuring-jetty-server");
        } else {
            legacyServerConfig = null;
        }
    }
    Element sslKeystoreConfigurator = XML.getChild(serverSpec, "ssl-keystore-configurator");
    Element sslTruststoreConfigurator = XML.getChild(serverSpec, "ssl-truststore-configurator");
    return new ConnectorFactory(name, port, legacyServerConfig, sslKeystoreConfigurator, sslTruststoreConfigurator);
}
Also used : ConnectorFactory(com.yahoo.vespa.model.container.http.ConnectorFactory) Element(org.w3c.dom.Element)

Example 2 with ConnectorFactory

use of com.yahoo.vespa.model.container.http.ConnectorFactory in project vespa by vespa-engine.

the class JettyContainerModelBuilderTest method ssl_keystore_and_truststore_configurator_can_be_overriden.

@Test
public void ssl_keystore_and_truststore_configurator_can_be_overriden() throws IOException, SAXException {
    Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0' jetty='true'>", "  <http>", "    <server port='9000' id='foo'>", "      <ssl-keystore-configurator class='com.yahoo.MySslKeyStoreConfigurator' bundle='mybundle'/>", "      <ssl-truststore-configurator class='com.yahoo.MySslTrustStoreConfigurator' bundle='mybundle'/>", "    </server>", "    <server port='9001' id='bar'/>", "  </http>", nodesXml, "</jdisc>");
    createModel(root, clusterElem);
    ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
    List<ConnectorFactory> connectorFactories = cluster.getChildrenByTypeRecursive(ConnectorFactory.class);
    {
        ConnectorFactory firstConnector = connectorFactories.get(0);
        assertConnectorHasInjectedComponents(firstConnector, "ssl-keystore-configurator@foo", "ssl-truststore-configurator@foo");
        assertComponentHasClassNameAndBundle(getChildComponent(firstConnector, 0), "com.yahoo.MySslKeyStoreConfigurator", "mybundle");
        assertComponentHasClassNameAndBundle(getChildComponent(firstConnector, 1), "com.yahoo.MySslTrustStoreConfigurator", "mybundle");
    }
    {
        ConnectorFactory secondConnector = connectorFactories.get(1);
        assertConnectorHasInjectedComponents(secondConnector, "ssl-keystore-configurator@bar", "ssl-truststore-configurator@bar");
        assertComponentHasClassNameAndBundle(getChildComponent(secondConnector, 0), DefaultSslKeyStoreConfigurator.class.getName(), "jdisc_http_service");
        assertComponentHasClassNameAndBundle(getChildComponent(secondConnector, 1), DefaultSslTrustStoreConfigurator.class.getName(), "jdisc_http_service");
    }
}
Also used : ConnectorFactory(com.yahoo.vespa.model.container.http.ConnectorFactory) Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with ConnectorFactory

use of com.yahoo.vespa.model.container.http.ConnectorFactory in project vespa by vespa-engine.

the class JettyHttpServerBuilder method doBuild.

@Override
protected JettyHttpServer doBuild(AbstractConfigProducer ancestor, Element http) {
    JettyHttpServer jettyHttpServer = new JettyHttpServer(new ComponentId("jdisc-jetty"));
    for (Element serverSpec : XML.getChildren(http, "server")) {
        ConnectorFactory connectorFactory = new JettyConnectorBuilder().build(ancestor, serverSpec);
        jettyHttpServer.addConnector(connectorFactory);
    }
    return jettyHttpServer;
}
Also used : ConnectorFactory(com.yahoo.vespa.model.container.http.ConnectorFactory) Element(org.w3c.dom.Element) ComponentId(com.yahoo.component.ComponentId) JettyHttpServer(com.yahoo.vespa.model.container.http.JettyHttpServer)

Aggregations

ConnectorFactory (com.yahoo.vespa.model.container.http.ConnectorFactory)3 Element (org.w3c.dom.Element)3 ComponentId (com.yahoo.component.ComponentId)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)1 Test (org.junit.Test)1