Search in sources :

Example 1 with CasEmbeddedApacheTomcatHttpProperties

use of org.apereo.cas.configuration.model.core.web.tomcat.CasEmbeddedApacheTomcatHttpProperties in project cas by apereo.

the class CasEmbeddedContainerTomcatConfiguration method configureHttp.

private void configureHttp(final TomcatEmbeddedServletContainerFactory tomcat) {
    final CasEmbeddedApacheTomcatHttpProperties http = casProperties.getServer().getHttp();
    if (http.isEnabled()) {
        LOGGER.debug("Creating HTTP configuration for the embedded tomcat container...");
        final Connector connector = new Connector(http.getProtocol());
        int port = http.getPort();
        if (port <= 0) {
            LOGGER.warn("No explicit port configuration is provided to CAS. Scanning for available ports...");
            port = SocketUtils.findAvailableTcpPort();
        }
        LOGGER.info("Activated embedded tomcat container HTTP port on [{}]", port);
        connector.setPort(port);
        LOGGER.debug("Configuring embedded tomcat container for HTTP2 protocol support");
        connector.addUpgradeProtocol(new Http2Protocol());
        http.getAttributes().forEach(connector::setAttribute);
        tomcat.addAdditionalTomcatConnectors(connector);
    }
}
Also used : CasEmbeddedApacheTomcatHttpProperties(org.apereo.cas.configuration.model.core.web.tomcat.CasEmbeddedApacheTomcatHttpProperties) Connector(org.apache.catalina.connector.Connector) SecurityConstraint(org.apache.tomcat.util.descriptor.web.SecurityConstraint) Http2Protocol(org.apache.coyote.http2.Http2Protocol)

Aggregations

Connector (org.apache.catalina.connector.Connector)1 Http2Protocol (org.apache.coyote.http2.Http2Protocol)1 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)1 CasEmbeddedApacheTomcatHttpProperties (org.apereo.cas.configuration.model.core.web.tomcat.CasEmbeddedApacheTomcatHttpProperties)1