/** * Undertow handlers */ @SuppressWarnings("unchecked") public T handlerConfiguration() { HandlerConfiguration<? extends HandlerConfiguration> child = new HandlerConfiguration<>(); this.subresources.handlerConfiguration = child; return (T) this; }
/** * Create and configure a ReverseProxy object to the list of subresources * * @param key * The key for the ReverseProxy resource * @return this */ @SuppressWarnings("unchecked") public T reverseProxy(java.lang.String childKey) { reverseProxy(childKey, null); return (T) this; }
/** * Create and configure a File object to the list of subresources * * @param key * The key for the File resource * @return this */ @SuppressWarnings("unchecked") public T file(java.lang.String childKey) { file(childKey, null); return (T) this; }
/** * Undertow handlers */ @SuppressWarnings("unchecked") public T handlerConfiguration() { HandlerConfiguration<? extends HandlerConfiguration> child = new HandlerConfiguration<>(); this.subresources.handlerConfiguration = child; return (T) this; }
/** * Create and configure a ReverseProxy object to the list of subresources * * @param key * The key for the ReverseProxy resource * @return this */ @SuppressWarnings("unchecked") public T reverseProxy(java.lang.String childKey) { reverseProxy(childKey, null); return (T) this; }
/** * Create and configure a File object to the list of subresources * * @param key * The key for the File resource * @return this */ @SuppressWarnings("unchecked") public T file(java.lang.String childKey) { file(childKey, null); return (T) this; }
/** * Undertow handlers */ @SuppressWarnings("unchecked") public T handlerConfiguration(HandlerConfigurationConsumer consumer) { HandlerConfiguration<? extends HandlerConfiguration> child = new HandlerConfiguration<>(); if (consumer != null) { consumer.accept(child); } this.subresources.handlerConfiguration = child; return (T) this; }
/** * Install a supplied ReverseProxy object to the list of subresources */ @SuppressWarnings("unchecked") public T reverseProxy(ReverseProxySupplier supplier) { reverseProxy(supplier.get()); return (T) this; }
/** * Install a supplied File object to the list of subresources */ @SuppressWarnings("unchecked") public T file(FileSupplier supplier) { file(supplier.get()); return (T) this; }
/** * Undertow handlers */ @SuppressWarnings("unchecked") public T handlerConfiguration(HandlerConfigurationConsumer consumer) { HandlerConfiguration<? extends HandlerConfiguration> child = new HandlerConfiguration<>(); if (consumer != null) { consumer.accept(child); } this.subresources.handlerConfiguration = child; return (T) this; }
/** * Install a supplied ReverseProxy object to the list of subresources */ @SuppressWarnings("unchecked") public T reverseProxy(ReverseProxySupplier supplier) { reverseProxy(supplier.get()); return (T) this; }
/** * Install a supplied File object to the list of subresources */ @SuppressWarnings("unchecked") public T file(FileSupplier supplier) { file(supplier.get()); return (T) this; }
/** * 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; }
/** * Create and configure a ReverseProxy object to the list of subresources * * @param key * The key for the ReverseProxy resource * @param config * The ReverseProxyConsumer to use * @return this */ @SuppressWarnings("unchecked") public T reverseProxy(java.lang.String childKey, ReverseProxyConsumer consumer) { ReverseProxy<? extends ReverseProxy> child = new ReverseProxy<>( childKey); if (consumer != null) { consumer.accept(child); } reverseProxy(child); return (T) this; }
/** * Create and configure a File object to the list of subresources * * @param key * The key for the File resource * @param config * The FileConsumer to use * @return this */ @SuppressWarnings("unchecked") public T file(java.lang.String childKey, FileConsumer consumer) { File<? extends File> child = new File<>(childKey); if (consumer != null) { consumer.accept(child); } file(child); 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; }
/** * Create and configure a ReverseProxy object to the list of subresources * * @param key * The key for the ReverseProxy resource * @param config * The ReverseProxyConsumer to use * @return this */ @SuppressWarnings("unchecked") public T reverseProxy(java.lang.String childKey, ReverseProxyConsumer consumer) { ReverseProxy<? extends ReverseProxy> child = new ReverseProxy<>( childKey); if (consumer != null) { consumer.accept(child); } reverseProxy(child); return (T) this; }
/** * Create and configure a File object to the list of subresources * * @param key * The key for the File resource * @param config * The FileConsumer to use * @return this */ @SuppressWarnings("unchecked") public T file(java.lang.String childKey, FileConsumer consumer) { File<? extends File> child = new File<>(childKey); if (consumer != null) { consumer.accept(child); } file(child); return (T) this; }
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 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); } } } } } }