当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentInfo.addInitialHandlerChainWrapper方法代码示例

本文整理汇总了Java中io.undertow.servlet.api.DeploymentInfo.addInitialHandlerChainWrapper方法的典型用法代码示例。如果您正苦于以下问题:Java DeploymentInfo.addInitialHandlerChainWrapper方法的具体用法?Java DeploymentInfo.addInitialHandlerChainWrapper怎么用?Java DeploymentInfo.addInitialHandlerChainWrapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.undertow.servlet.api.DeploymentInfo的用法示例。


在下文中一共展示了DeploymentInfo.addInitialHandlerChainWrapper方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customize

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
@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);
                        }
                    }
                });
        }
    );
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:18,代码来源:EventBusToServerSentEvents.java

示例2: customize

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
@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);
                        }
                    }
                });
        }
    );
}
 
开发者ID:syndesisio,项目名称:syndesis-rest,代码行数:18,代码来源:EventBusToWebSocket.java

示例3: configureAccessLog

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
private void configureAccessLog(DeploymentInfo deploymentInfo) {
	deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() {

		@Override
		public HttpHandler wrap(HttpHandler handler) {
			return createAccessLogHandler(handler);
		}

	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:UndertowEmbeddedServletContainerFactory.java

示例4: handleDeployment

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
@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;
    });
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:29,代码来源:TimerLoggerServletExtension.java

示例5: handleDeployment

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
@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;
    });

}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:63,代码来源:OpenshiftAuthServletExtension.java

示例6: addCacheHandler

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
private void addCacheHandler(final DeploymentInfo servletBuilder) {
    // this handles mime types and adds a simple cache for static files
    servletBuilder.addInitialHandlerChainWrapper(new HandlerWrapper() {
        @Override
        public HttpHandler wrap(final HttpHandler handler) {
          final ResourceHandler resourceHandler = new ResourceHandler(servletBuilder.getResourceManager());
            io.undertow.util.MimeMappings.Builder mimes = MimeMappings.builder();
            List<String> suffixList = new ArrayList<String>();
            // add font mime types not included by default
            mimes.addMapping("eot", "application/vnd.ms-fontobject");
            mimes.addMapping("otf", "font/opentype");
            mimes.addMapping("ttf", "application/x-font-ttf");
            mimes.addMapping("woff", "application/x-font-woff");
            suffixList.addAll(Arrays.asList(".eot",".otf",".ttf",".woff"));
            // add the default types and any added in web.xml files
            for(MimeMapping mime : servletBuilder.getMimeMappings()) {
                log.debug("Adding mime-type: " + mime.getExtension() + " - " + mime.getMimeType());
                mimes.addMapping(mime.getExtension(), mime.getMimeType());
                suffixList.add("."+mime.getExtension());
            }
            resourceHandler.setMimeMappings(mimes.build());
            String[] suffixes = new String[suffixList.size()];
            suffixes = suffixList.toArray(suffixes);
            // simple cacheHandler, someday maybe make this configurable
            final CacheHandler cacheHandler = new CacheHandler(new DirectBufferCache(1024, 10, 10480), resourceHandler);
            final PredicateHandler predicateHandler = predicate(Predicates.suffixes(suffixes), cacheHandler, handler);
            return predicateHandler;
        }
    });
}
 
开发者ID:cfmlprojects,项目名称:runwar,代码行数:31,代码来源:Server.java

示例7: addUndertowHttpHandlerWrapper

import io.undertow.servlet.api.DeploymentInfo; //导入方法依赖的package包/类
/**
 * Adds the Undertow HTTP handler wrapper.
 *
 * @param deploymentInfo the Undertow deployment info.
 */
private void addUndertowHttpHandlerWrapper(DeploymentInfo deploymentInfo) {
    deploymentInfo.addInitialHandlerChainWrapper(this::wrapUndertowHttpHandler);
}
 
开发者ID:akihyro,项目名称:logback-access-spring-boot-starter,代码行数:9,代码来源:UndertowLogbackAccessInstaller.java


注:本文中的io.undertow.servlet.api.DeploymentInfo.addInitialHandlerChainWrapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。