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


Java Handlers.path方法代码示例

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


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

示例1: start

import io.undertow.Handlers; //导入方法依赖的package包/类
public void start() {
    PathHandler pathHandler = Handlers.path();
    for (String name : handlers.keySet()) {
        pathHandler.addPrefixPath(name, handlers.get(name));
    }
    this.server = Undertow.builder().addHttpListener(port, "0.0.0.0", pathHandler).build();
    server.start();
    this.graph.storage().listen(this);//stop
}
 
开发者ID:datathings,项目名称:greycat,代码行数:10,代码来源:WSSharedServer.java

示例2: start

import io.undertow.Handlers; //导入方法依赖的package包/类
public void start() {
    final PathHandler pathHandler = Handlers.path();
    for (String name : handlers.keySet()) {
        pathHandler.addPrefixPath(name, handlers.get(name));
    }
    this.server = Undertow.builder().addHttpListener(port, "0.0.0.0", pathHandler).build();
    server.start();
    if (builder.storage != null) {
        builder.storage.listen(this);
    } else if (builder.storageFactory != null) {
        builder.storageFactory.listen(this);
    }
}
 
开发者ID:datathings,项目名称:greycat,代码行数:14,代码来源:WSServer.java

示例3: initUndertowServer

import io.undertow.Handlers; //导入方法依赖的package包/类
public void initUndertowServer() {


        JbootServerClassloader classloader = new JbootServerClassloader(UnderTowServer.class.getClassLoader());
        classloader.setDefaultAssertionStatus(false);


        deploymentInfo = buildDeploymentInfo(classloader);

        if (webConfig.isWebsocketEnable()) {
            Set<Class> endPointClasses = JbootWebsocketManager.me().getWebsocketEndPoints();
            WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
            webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(true, webConfig.getWebsocketBufferPoolSize()));
            for (Class endPointClass : endPointClasses) {
                webSocketDeploymentInfo.addEndpoint(endPointClass);
            }
            deploymentInfo.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSocketDeploymentInfo);
        }

        servletContainer = Servlets.newContainer();
        deploymentManager = servletContainer.addDeployment(deploymentInfo);
        deploymentManager.deploy();

        HttpHandler httpHandler = null;
        try {
            /**
             * 启动并初始化servlet和filter
             */
            httpHandler = deploymentManager.start();
        } catch (Throwable ex) {
            ex.printStackTrace();
        }


        pathHandler = Handlers.path(
                Handlers.resource(new ClassPathResourceManager(classloader, "webRoot")));

        pathHandler.addPrefixPath(config.getContextPath(), httpHandler);

        undertow = Undertow.builder()
                .addHttpListener(config.getPort(), config.getHost())
                .setHandler(pathHandler)
                .build();

    }
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:46,代码来源:UnderTowServer.java

示例4: startServer

import io.undertow.Handlers; //导入方法依赖的package包/类
/**
 * Start server on the given port.
 *
 * @param port
 */
public static void startServer(int port) {

    LOGGER.info(String.format("Starting server on port %d", port));

    PathHandler path = Handlers.path();

    server = Undertow.builder()
            .addHttpListener(port, "localhost")
            .setHandler(path)
            .build();

    server.start();

    LOGGER.info(String.format("Server started on port %d", port));

    DeploymentInfo servletBuilder = Servlets.deployment()
            .setClassLoader(Application.class.getClassLoader())
            .setContextPath("/")
            .addListeners(listener(Listener.class))
            .setResourceManager(new ClassPathResourceManager(Application.class.getClassLoader()))
            .addServlets(
                    Servlets.servlet("jerseyServlet", ServletContainer.class)
                            .setLoadOnStartup(1)
                            .addInitParam("javax.ws.rs.Application", JerseyConfig.class.getName())
                            .addMapping("/api/*"))
            .setDeploymentName("application.war");

    LOGGER.info("Starting application deployment");

    deploymentManager = Servlets.defaultContainer().addDeployment(servletBuilder);
    deploymentManager.deploy();

    try {
        path.addPrefixPath("/", deploymentManager.start());
    } catch (ServletException e) {
        throw new RuntimeException(e);
    }

    LOGGER.info("Application deployed");
}
 
开发者ID:cassiomolin,项目名称:jersey-jwt,代码行数:46,代码来源:Application.java


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