Search in sources :

Example 1 with Host

use of org.wildfly.swarm.config.undertow.server.Host in project wildfly-swarm by wildfly-swarm.

the class TopologyProxiedServiceCustomizer method customize.

public void customize() {
    Map<String, String> mappings = this.fraction.proxiedServiceMappings();
    if (!mappings.isEmpty()) {
        HandlerConfiguration handlerConfig = undertow.subresources().handlerConfiguration();
        for (String serviceName : mappings.keySet()) {
            ReverseProxy<?> proxy = new ReverseProxy<>(proxyHandlerName(serviceName)).hosts(Collections.emptyList());
            handlerConfig.reverseProxy(proxy);
            String contextPath = mappings.get(serviceName);
            for (Server server : undertow.subresources().servers()) {
                Location location = new Location(contextPath).handler(proxyHandlerName(serviceName));
                for (Host host : server.subresources().hosts()) {
                    host.location(location);
                }
            }
        }
    }
}
Also used : HandlerConfiguration(org.wildfly.swarm.config.undertow.HandlerConfiguration) Server(org.wildfly.swarm.config.undertow.Server) Host(org.wildfly.swarm.config.undertow.server.Host) Location(org.wildfly.swarm.config.undertow.server.host.Location)

Aggregations

HandlerConfiguration (org.wildfly.swarm.config.undertow.HandlerConfiguration)1 Server (org.wildfly.swarm.config.undertow.Server)1 Host (org.wildfly.swarm.config.undertow.server.Host)1 Location (org.wildfly.swarm.config.undertow.server.host.Location)1