@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); } };
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()); }
private HttpHandler setupRoutes(HttpHandler handler) { final SimpleSessionIdentifierCodec codec = new SimpleSessionIdentifierCodec(new SimpleRoutingSupport(), this.host.getValue().getServer().getRoute()); return exchange -> { exchange.addResponseCommitListener(ex -> { Cookie cookie = ex.getResponseCookies().get(JSESSIONID); if(cookie != null ) { cookie.setValue(codec.encode(cookie.getValue())); } }); handler.handleRequest(exchange); }; }
public boolean filter(Host host) { return host.getServer().getName().equals(serverName); }
private void validateEndpointPort(URI httpURI) { // Camel HTTP endpoint port defaults are 0 or -1 boolean portMatched = httpURI.getPort() == 0 || httpURI.getPort() == -1; // If a port was specified, verify that undertow has a listener configured for it if (!portMatched) { for (UndertowListener listener : defaultHost.getServer().getListeners()) { SocketBinding binding = listener.getSocketBinding(); if (binding != null) { if (binding.getPort() == httpURI.getPort()) { portMatched = true; break; } } } } if (!"localhost".equals(httpURI.getHost())) { LOGGER.debug("Cannot bind to host other than 'localhost': {}", httpURI); } if (!portMatched) { LOGGER.debug("Cannot bind to specific port: {}", httpURI); } }
@Override public Integer getVirtualHostPort(String hostname, boolean securePort) { ServerHostInfo hostInfo = new ServerHostInfo(hostname); Host undertowHost = getUndertowHost(hostInfo); if (undertowHost != null && !undertowHost.getServer().getListeners().isEmpty()) { for(UndertowListener listener : undertowHost.getServer().getListeners()) { if (listener.isSecure() == securePort) { return listener.getSocketBinding().getAbsolutePort(); } } } return null; }
@Override public Integer getVirtualHostPort(String hostname, boolean securePort) { ServerHostInfo hostInfo = new ServerHostInfo(hostname); Host undertowHost = getUndertowHost(hostInfo); if (undertowHost != null && !undertowHost.getServer().getListeners().isEmpty()) { for(UndertowListener listener : undertowHost.getServer().getListeners()) { if (listener.isSecure() == securePort) { return listener.getSocketBinding().getAbsolutePort(); } } } return null; }
@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 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); } };
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()); }
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()); }
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)); }
private HttpHandler setupRoutes(HttpHandler handler) { final SimpleSessionIdentifierCodec codec = new SimpleSessionIdentifierCodec(new SimpleRoutingSupport(), this.host.getValue().getServer().getRoute()); return exchange -> { exchange.addResponseCommitListener(ex -> { Cookie cookie = ex.getResponseCookies().get(JSESSIONID); if(cookie != null ) { cookie.setValue(codec.encode(cookie.getValue())); } }); handler.handleRequest(exchange); }; }
private HttpHandler setupRoutes(HttpHandler handler) { final SimpleSessionIdentifierCodec codec = new SimpleSessionIdentifierCodec(new SimpleRoutingSupport(), this.host.getValue().getServer().getRoute()); return exchange -> { exchange.addResponseCommitListener(ex -> { Cookie cookie = ex.getResponseCookies().get(JSESSIONID); if(cookie != null ) { cookie.setValue(codec.encode(cookie.getValue())); } }); handler.handleRequest(exchange); }; }
private Context createContext(Deployment deployment, Host host) { return new UndertowContext(deployment, new UndertowHost(host, new UndertowEngine(serverName, host.getServer().getValue(), this.configuration.getUndertowService(), this.connector))); }
private Context createContext(String contextPath, Host host) { return new LocationContext(contextPath, new UndertowHost(host, new UndertowEngine(serverName, host.getServer().getValue(), this.configuration.getUndertowService(), this.connector))); }