當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。