/** * Create and configure a Host object to the list of subresources * * @param key * The key for the Host resource * @return this */ @SuppressWarnings("unchecked") public T host(java.lang.String childKey) { host(childKey, null); return (T) this; }
/** * Create and configure a HTTPListener object to the list of subresources * * @param key * The key for the HTTPListener resource * @return this */ @SuppressWarnings("unchecked") public T httpListener(java.lang.String childKey) { httpListener(childKey, null); return (T) this; }
/** * Create and configure a HttpsListener object to the list of subresources * * @param key * The key for the HttpsListener resource * @return this */ @SuppressWarnings("unchecked") public T httpsListener(java.lang.String childKey) { httpsListener(childKey, null); return (T) this; }
/** * Create the default, HTTP-only fraction. * * @return The configured fraction. */ public static UndertowFraction createDefaultFraction() { UndertowFraction fraction = new UndertowFraction(); fraction.server( new Server("default-server") .httpListener(new HTTPListener("default") .socketBinding("http")) .host(new Host("default-host"))) .bufferCache(new BufferCache("default")) .servletContainer(new ServletContainer("default") .websocketsSetting(new WebsocketsSetting()) .jspSetting(new JSPSetting())) .handlerConfiguration(new HandlerConfiguration()); return fraction; }
if (server.subresources().httpsListeners().isEmpty()) { server.httpsListener("default-https", (listener) -> { listener.securityRealm("SSLRealm"); listener.socketBinding("https"); .filter(server -> server.subresources().ajpListeners().isEmpty()) .forEach(server -> server.ajpListener("ajp", listener -> listener.socketBinding("ajp")));
private UndertowFraction removeHttpListenersFromDefaultServer() { this.subresources().server("default-server") .subresources().httpListeners().clear(); return this; }
@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); }); }); } }
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())); } }
/** * Create and configure a AJPListener object to the list of subresources * * @param key * The key for the AJPListener resource * @return this */ @SuppressWarnings("unchecked") public T ajpListener(java.lang.String childKey) { ajpListener(childKey, null); return (T) this; }
/** * Create and configure a Server object to the list of subresources * * @param key * The key for the Server resource * @param config * The ServerConsumer to use * @return this */ @SuppressWarnings("unchecked") public T server(java.lang.String childKey, ServerConsumer consumer) { Server<? extends Server> child = new Server<>(childKey); if (consumer != null) { consumer.accept(child); } server(child); return (T) this; }
public Server server(java.lang.String key) { return this.servers.stream().filter(e -> e.getKey().equals(key)) .findFirst().orElse(null); } /**
public UndertowFraction applyDefaults() { defaultServer(DEFAULT_SERVER) .defaultVirtualHost(DEFAULT_HOST) .defaultServletContainer(DEFAULT_SERVLET_CONTAINER) .defaultSecurityDomain("other") .server(new Server(DEFAULT_SERVER) .httpListener(DEFAULT_HTTP_LISTENER, (listener) -> { listener.socketBinding("http"); }) .host(new Host(DEFAULT_HOST))) .bufferCache(new BufferCache(DEFAULT_BUFFER_CACHE)) .servletContainer(new ServletContainer(DEFAULT_SERVLET_CONTAINER) .websocketsSetting(new WebsocketsSetting()) .jspSetting(new JSPSetting())) .handlerConfiguration(new HandlerConfiguration()); return this; }
public UndertowFraction removeHttpListenersFromDefaultServer() { this.subresources().server("default-server") .subresources().httpListeners().clear(); return this; }
if (server.subresources().httpsListeners().isEmpty()) { server.httpsListener("default-https", (listener) -> { listener.securityRealm("SSLRealm"); listener.socketBinding("https");
/** * Create and configure a AJPListener object to the list of subresources * * @param key * The key for the AJPListener resource * @return this */ @SuppressWarnings("unchecked") public T ajpListener(java.lang.String childKey) { ajpListener(childKey, null); return (T) this; }
/** * Create and configure a Server object to the list of subresources * * @param key * The key for the Server resource * @param config * The ServerConsumer to use * @return this */ @SuppressWarnings("unchecked") public T server(java.lang.String childKey, ServerConsumer consumer) { Server<? extends Server> child = new Server<>(childKey); if (consumer != null) { consumer.accept(child); } server(child); return (T) this; }
public Server server(java.lang.String key) { return this.servers.stream().filter(e -> e.getKey().equals(key)) .findFirst().orElse(null); } /**
/** * Create the default, HTTP-only fraction. * * @return The configured fraction. */ @Default public static UndertowFraction createDefaultFraction() { UndertowFraction fraction = new UndertowFraction(); final boolean enabled = ( System.getProperty( SwarmProperties.HTTP_EAGER ) != null ); fraction.server( new Server("default-server") .httpListener("default", (listener) -> { listener.socketBinding("http") .enabled(enabled); }) .host(new Host("default-host"))) .bufferCache(new BufferCache("default")) .servletContainer(new ServletContainer("default") .websocketsSetting(new WebsocketsSetting()) .jspSetting(new JSPSetting())) .handlerConfiguration(new HandlerConfiguration()); return fraction; }
@Override public void customize() { if (!supportsHTTP2()) { SwarmMessages.MESSAGES.http2NotSupported(); return; } for (Server server : undertow.subresources().servers()) { server.subresources().httpsListeners().forEach(httpsListener -> httpsListener.enableHttp2(true)); } }
/** * Create and configure a HTTPListener object to the list of subresources * * @param key * The key for the HTTPListener resource * @return this */ @SuppressWarnings("unchecked") public T httpListener(java.lang.String childKey) { httpListener(childKey, null); return (T) this; }