public UndertowFraction removeHttpListenersFromDefaultServer() { this.subresources().server("default-server") .subresources().httpListeners().clear(); return this; }
private UndertowFraction removeHttpListenersFromDefaultServer() { this.subresources().server("default-server") .subresources().httpListeners().clear(); return this; }
public void customize() { if (undertow.isEnableAJP()) { undertow.subresources().servers().stream() .filter(server -> server.subresources().ajpListeners().isEmpty()) .forEach(server -> server.ajpListener("ajp", listener -> listener.socketBinding("ajp"))); this.group.socketBinding( new SocketBinding("ajp") .port(undertow.ajpPort())); } }
@Override public void customize() { if (!supportsHTTP2()) { SwarmMessages.MESSAGES.http2NotSupported(); return; } for (Server server : undertow.subresources().servers()) { server.subresources().httpsListeners().forEach(httpsListener -> httpsListener.enableHttp2(true)); } }
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); } } } } } }
@Override public void postInitialize(Container.PostInitContext initContext) { if (this.keystorePassword != null & this.keystorePassword != null && this.alias != null) { ManagementCoreService management = (ManagementCoreService) initContext.fraction("management"); if (management == null) { throw new RuntimeException("HTTPS configured but org.wildfly.swarm:management not available"); } List<Server> servers = subresources().servers(); for (Server server : servers) { if (server.subresources().httpsListeners().isEmpty()) { if (server.subresources().httpListener("default").socketBinding().equals("http")) { server.httpsListener("default-https", (listener) -> { listener.securityRealm("SSLRealm"); listener.socketBinding("https"); }); } } } management.securityRealm("SSLRealm", (realm) -> { realm.sslServerIdentity((identity) -> { identity.keystorePath(this.keystorePath); identity.keystorePassword(this.keystorePassword); identity.alias(this.alias); }); }); } }
if (server.subresources().httpsListeners().isEmpty()) { server.httpsListener("default-https", (listener) -> { listener.securityRealm("SSLRealm"); .filter(server -> server.subresources().ajpListeners().isEmpty()) .forEach(server -> server.ajpListener("ajp", listener -> listener.socketBinding("ajp")));
@Override public void customize() { if (!undertowFractionInstance.isUnsatisfied()) { UndertowFraction undertow = undertowFractionInstance.get(); if (undertow.subresources().filterConfiguration() == null) { undertow.filterConfiguration(); } undertow.subresources().filterConfiguration() .customFilter("wfs-openapi", customFilter -> { customFilter.module("org.wildfly.swarm.microprofile.openapi:runtime"); customFilter.className("org.wildfly.swarm.microprofile.openapi.runtime.OpenApiHttpHandler"); }); undertow.subresources().server("default-server") .subresources().host("default-host") .filterRef("wfs-openapi", f -> { f.priority(100); }); } else { throw new RuntimeException("The microprofile-openapi fraction requires the undertow fraction!"); } } }
@Override public void customize() { if (!undertowFractionInstance.isUnsatisfied()) { UndertowFraction undertow = undertowFractionInstance.get(); if (undertow.subresources().filterConfiguration() == null) { undertow.filterConfiguration(); } undertow.subresources().filterConfiguration() .customFilter("wfs-health", customFilter -> { customFilter.module("org.wildfly.swarm.microprofile.health:runtime"); customFilter.className("org.wildfly.swarm.microprofile.health.runtime.SecureHttpContexts"); }); undertow.subresources().server("default-server") .subresources().host("default-host") .filterRef("wfs-health", f -> { f.priority(100); }); } else { throw new RuntimeException("The health fraction requires the undertow fraction!"); } } }
@Override public void customize() { if (!undertowFractionInstance.isUnsatisfied()) { UndertowFraction undertow = undertowFractionInstance.get(); if (undertow.subresources().filterConfiguration() == null) { undertow.filterConfiguration(); } undertow.subresources().filterConfiguration() .customFilter("wfs-monitor", customFilter -> { customFilter.module("org.wildfly.swarm.monitor:runtime"); customFilter.className("org.wildfly.swarm.monitor.runtime.SecureHttpContexts"); }); undertow.subresources().server("default-server") .subresources().host("default-host") .filterRef("wfs-monitor", f -> { f.priority(100); }); } else { throw new RuntimeException("The monitor fraction requires the undertow fraction!"); } } }
if (server.subresources().httpsListeners().isEmpty()) { server.httpsListener("default-https", (listener) -> { listener.securityRealm("SSLRealm");