Java Code Examples for io.undertow.servlet.api.DeploymentInfo#addInitialHandlerChainWrapper()
The following examples show how to use
io.undertow.servlet.api.DeploymentInfo#addInitialHandlerChainWrapper() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventBusToWebSocket.java From syndesis with Apache License 2.0 | 6 votes |
@Override public void customize(DeploymentInfo deploymentInfo) { deploymentInfo.addInitialHandlerChainWrapper(handler -> { return Handlers.path() .addPrefixPath("/", handler) .addPrefixPath(path, new WebSocketProtocolHandshakeHandler(new WSHandler()) { @Override @SuppressWarnings("PMD.SignatureDeclareThrowsException") public void handleRequest(HttpServerExchange exchange) throws Exception { if (reservationCheck(exchange)) { super.handleRequest(exchange); } } }); } ); }
Example 2
Source File: EventBusToServerSentEvents.java From syndesis with Apache License 2.0 | 6 votes |
@Override public void customize(DeploymentInfo deploymentInfo) { deploymentInfo.addInitialHandlerChainWrapper(handler -> { return Handlers.path() .addPrefixPath("/", handler) .addPrefixPath(path, new ServerSentEventHandler(new EventBusHandler()){ @Override @SuppressWarnings("PMD.SignatureDeclareThrowsException") public void handleRequest(HttpServerExchange exchange) throws Exception { if( reservationCheck(exchange) ) { super.handleRequest(exchange); } } }); } ); }
Example 3
Source File: TimerLoggerServletExtension.java From hawkular-metrics with Apache License 2.0 | 5 votes |
@Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { long timeThreshold = DEFAULT_THRESHOLD_VALUE; String thresholdValue; thresholdValue = System.getProperty(THRESHOLD_PROPERTY_KEY); if ( thresholdValue == null){ thresholdValue = System.getenv(THRESHOLD_ENV_VAR); } if ( thresholdValue != null && !thresholdValue.isEmpty()) { try { timeThreshold = Long.parseLong(thresholdValue); } catch (Exception e) { throw new RuntimeException(e); } } final long cTimeThreshold = timeThreshold; deploymentInfo.addInitialHandlerChainWrapper(containerHandler -> { requestTimeLogger = new RequestTimeLogger(containerHandler, cTimeThreshold); return requestTimeLogger; }); }
Example 4
Source File: HttpErrorLoggerExtension.java From hawkular-metrics with Apache License 2.0 | 5 votes |
@Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { deploymentInfo.addInitialHandlerChainWrapper(containerHandler -> { httpErrorHandler = new HttpErrorHandler(containerHandler); return httpErrorHandler; }); }
Example 5
Source File: OpenshiftAuthServletExtension.java From hawkular-metrics with Apache License 2.0 | 4 votes |
@Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { String componentName = ""; String resourceName = ""; Pattern insecureEndpointPattern = null; Pattern postQueryPattern = null; // file to contain configurations options for this Servlet Extension InputStream is = servletContext.getResourceAsStream(PROPERTY_FILE); if (is != null) { try { Properties props = new Properties(); props.load(is); componentName = props.getProperty("component"); resourceName = props.getProperty("resource-name"); String insecurePatternString = props.getProperty("unsecure-endpoints"); String postQueryPatternString = props.getProperty("post-query"); if (insecurePatternString != null) { insecureEndpointPattern = Pattern.compile(insecurePatternString); } if (postQueryPatternString != null) { postQueryPattern = Pattern.compile(postQueryPatternString); } } catch (Exception e) { throw new RuntimeException(e); } } if (componentName == null || componentName.isEmpty()) { throw new RuntimeException("Missing or empty 'component' key from the " + PROPERTY_FILE + " configuration file."); } if (resourceName == null || resourceName.isEmpty()) { throw new RuntimeException("Missing or empty 'resource-name' key from the " + PROPERTY_FILE + " configuratin file."); } final String cName = componentName; final String rName = resourceName; final Pattern insecurePattern = insecureEndpointPattern; final Pattern postQuery = postQueryPattern; if (DISABLE_NAMESPACE_FILTER.equalsIgnoreCase("true")) { log.info("The OpenShift Namespace Filter has been disabled via the 'DISABLE_NAMESPACE_FILTER' system property."); } else { log.info("Enabling the OpenShift Namespace Filter."); deploymentInfo.addInitialHandlerChainWrapper(containerHandler -> { namespaceHandler = new NamespaceHandler(containerHandler); return namespaceHandler; }); } ImmediateInstanceFactory<EventListener> instanceFactory = new ImmediateInstanceFactory<>(new SCListener()); deploymentInfo.addListener(new ListenerInfo(SCListener.class, instanceFactory)); deploymentInfo.addInitialHandlerChainWrapper(containerHandler -> { openshiftAuthHandler = new OpenshiftAuthHandler(containerHandler, cName, rName, insecurePattern, postQuery); return openshiftAuthHandler; }); }
Example 6
Source File: UndertowLogbackAccessInstaller.java From logback-access-spring-boot-starter with Apache License 2.0 | 2 votes |
/** * Adds the Undertow HTTP handler wrapper. * * @param deploymentInfo the Undertow deployment info. */ private void addUndertowHttpHandlerWrapper(DeploymentInfo deploymentInfo) { deploymentInfo.addInitialHandlerChainWrapper(this::wrapUndertowHttpHandler); }