protected void unregisterHost(Host host) { for (String hostName : host.getAllAliases()) { virtualHostHandler.removeHost(hostName); hosts.remove(host); } if (host.getName().equals(getDefaultHost())) { virtualHostHandler.setDefaultHandler(ResponseCodeHandler.HANDLE_404); } }
@Override public int getConfidentialPort(HttpServerExchange exchange) { int port = exchange.getConnection().getLocalAddress(InetSocketAddress.class).getPort(); if (port<0){ UndertowLogger.ROOT_LOGGER.debugf("Confidential port not defined for port %s", port); } return host.getValue().getServer().getValue().lookupSecurePort(port); } };
@Override public void start() throws Exception { HttpHandler handler = manager.start(); host.getValue().registerDeployment(manager.getDeployment(), handler); }
protected void registerHost(final Host host) { hosts.add(host); for (String hostName : host.getAllAliases()) { virtualHostHandler.addHost(hostName, host.getRootHandler()); } if (host.getName().equals(getDefaultHost())) { virtualHostHandler.setDefaultHandler(host.getRootHandler()); } }
@Override public void stop(final StopContext stopContext) { final Host host = hostInjector.getValue(); UndertowLogger.ROOT_LOGGER.debugf("Stopping console redirect for %s", host.getName()); host.unregisterHandler(CONSOLE_PATH); }
@Override public void start(StartContext context) throws StartException { RequestController rq = requestControllerInjectedValue.getOptionalValue(); if(rq != null) { controlPoint = rq.getControlPoint("", "org.wildfly.undertow.webhost." + server.getValue().getName() + "." + host.getValue().getName()); } }
public void registerDeployment(final Deployment deployment, HttpHandler handler) { DeploymentInfo deploymentInfo = deployment.getDeploymentInfo(); String path = getDeployedContextPath(deploymentInfo); registerHandler(path, handler); deployments.add(deployment); UndertowLogger.ROOT_LOGGER.registerWebapp(path, getServer().getName()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStart(deployment, Host.this)); }
public void unregisterDeployment(final Deployment deployment) { DeploymentInfo deploymentInfo = deployment.getDeploymentInfo(); String path = getDeployedContextPath(deploymentInfo); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStop(deployment, Host.this)); unregisterHandler(path); deployments.remove(deployment); UndertowLogger.ROOT_LOGGER.unregisterWebapp(path, getServer().getName()); }
final Host service = new Host(name, aliases == null ? new LinkedList<>(): aliases, defaultWebModule, defaultResponseCode, queueRequestsOnStart); .addCapabilityRequirement(Capabilities.CAPABILITY_SERVER, Server.class, service.getServerInjection(), serverName) .addCapabilityRequirement(Capabilities.CAPABILITY_UNDERTOW, UndertowService.class, service.getUndertowService()) .addDependency(SuspendController.SERVICE_NAME, SuspendController.class, service.getSuspendControllerInjectedValue()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getControlledProcessStateServiceInjectedValue());
@Override public void start(final StartContext startContext) throws StartException { final Host host = hostInjector.getValue(); UndertowLogger.ROOT_LOGGER.debugf("Starting console redirect for %s", host.getName()); final HttpManagement httpManagement = httpManagementInjector.getOptionalValue(); if (httpManagement != null) { if (httpManagement.hasConsole()) { host.registerHandler(CONSOLE_PATH, new ConsoleRedirectHandler(httpManagement)); } else { host.registerHandler(CONSOLE_PATH, new RedirectHandler(NO_CONSOLE)); } } else { host.registerHandler(CONSOLE_PATH, new RedirectHandler(NO_CONSOLE)); } }
@Override public Set<String> getAliases() { return this.host.getAllAliases(); }
@Override public void stop() throws Exception { host.getValue().unregisterDeployment(manager.getDeployment()); manager.stop(); }
@Override public Context findContext(String path) { String findPath = "".equals(path) ? "/" : path; for (Deployment deployment : this.host.getDeployments()) { if (deployment.getDeploymentInfo().getContextPath().equals(findPath)) { return new UndertowContext(deployment, this); } } return null; }
@Override public Iterable<Context> getContexts() { List<Context> contexts = new ArrayList<>(); for (Deployment deployment : this.host.getDeployments()) { contexts.add(new UndertowContext(deployment, this)); } for (String path : this.host.getLocations()) { contexts.add(new LocationContext(path, this)); } return contexts; }
protected HttpHandler getOrCreateRootHandler() { HttpHandler root = rootHandler; if(root == null) { synchronized (this) { root = rootHandler; if(root == null) { return rootHandler = configureRootHandler(); } } } return root; }
protected void registerHost(final Host host) { hosts.add(host); for (String hostName : host.getAllAliases()) { virtualHostHandler.addHost(hostName, host.getRootHandler()); } if (host.getName().equals(getDefaultHost())) { virtualHostHandler.setDefaultHandler(host.getRootHandler()); } }
d.setHostName(host.getValue().getName());
public void registerDeployment(final Deployment deployment, HttpHandler handler) { DeploymentInfo deploymentInfo = deployment.getDeploymentInfo(); String path = getDeployedContextPath(deploymentInfo); registerHandler(path, handler); deployments.add(deployment); UndertowLogger.ROOT_LOGGER.registerWebapp(path, getServer().getName()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStart(deployment, Host.this)); }
public void unregisterDeployment(final Deployment deployment) { DeploymentInfo deploymentInfo = deployment.getDeploymentInfo(); String path = getDeployedContextPath(deploymentInfo); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStop(deployment, Host.this)); unregisterHandler(path); deployments.remove(deployment); UndertowLogger.ROOT_LOGGER.unregisterWebapp(path, getServer().getName()); }
final Host service = new Host(name, aliases == null ? new LinkedList<>(): aliases, defaultWebModule, defaultResponseCode, queueRequestsOnStart); .addCapabilityRequirement(Capabilities.CAPABILITY_SERVER, Server.class, service.getServerInjection(), serverName) .addCapabilityRequirement(Capabilities.CAPABILITY_UNDERTOW, UndertowService.class, service.getUndertowService()) .addDependency(SuspendController.SERVICE_NAME, SuspendController.class, service.getSuspendControllerInjectedValue()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getControlledProcessStateServiceInjectedValue());