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


Java Resource.newSystemResource方法代码示例

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


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

示例1: start

import org.eclipse.jetty.util.resource.Resource; //导入方法依赖的package包/类
public void start() throws Exception {
    Resource configXml = Resource.newSystemResource(config);
    XmlConfiguration configuration = new XmlConfiguration(configXml.getInputStream());
    server = (Server) configuration.configure();

    //        Integer port = getPort();
    //        if (port != null && port > 0) {
    //            Connector[] connectors = server.getConnectors();
    //            for (Connector connector : connectors) {
    //                connector.setPort(port);
    //            }
    //        }
    Handler handler = server.getHandler();
    if (handler != null && handler instanceof WebAppContext) {
        WebAppContext webAppContext = (WebAppContext) handler;
        webAppContext.setResourceBase(JettyEmbedServer.class.getResource("/webapp").toString());
    }
    server.start();
    if (logger.isInfoEnabled()) {
        logger.info("##Jetty Embed Server is startup!");
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:23,代码来源:JettyEmbedServer.java

示例2: afterPropertiesSet

import org.eclipse.jetty.util.resource.Resource; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
    Resource configXml = Resource.newSystemResource(config);
    XmlConfiguration configuration = new XmlConfiguration(configXml.getInputStream());
    server = (Server) configuration.configure();
    Integer port = getPort();
    if (port != null && port > 0) {
        Connector[] connectors = server.getConnectors();
        for (Connector connector : connectors) {
            connector.setPort(port);
        }
    }

    Handler handler = server.getHandler();
    if (handler != null && handler instanceof ServletContextHandler) {
        ServletContextHandler servletHandler = (ServletContextHandler) handler;
        servletHandler.getInitParams().put("org.eclipse.jetty.servlet.Default.resourceBase", htdocsDir);
    }

    server.start();
    if (logger.isInfoEnabled()) {
        logger.info("##Jetty Embed Server is startup!");
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:24,代码来源:JettyEmbedServer.java

示例3: main

import org.eclipse.jetty.util.resource.Resource; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
    Resource jetty_xml = Resource.newSystemResource("jetty/jetty.xml");
    XmlConfiguration configuration = new XmlConfiguration(jetty_xml.getInputStream());
    Server server = (Server) configuration.configure();
    int port = 8081;
    Connector[] connectors = server.getConnectors();
    for (Connector connector : connectors) {
        connector.setPort(port);
    }

    Handler handler = server.getHandler();
    if (handler != null && handler instanceof ServletContextHandler) {
        ServletContextHandler servletHandler = (ServletContextHandler) handler;
        servletHandler.getInitParams().put("org.eclipse.jetty.servlet.Default.resourceBase", "/tmp/");
    }

    server.start();
    server.join();
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:20,代码来源:JettyEmbedIntegration.java

示例4: start

import org.eclipse.jetty.util.resource.Resource; //导入方法依赖的package包/类
public void start() throws Exception {
    Resource configXml = Resource.newSystemResource(config);
    XmlConfiguration configuration = new XmlConfiguration(configXml.getInputStream());
    server = (Server) configuration.configure();

    // Integer port = getPort();
    // if (port != null && port > 0) {
    // Connector[] connectors = server.getConnectors();
    // for (Connector connector : connectors) {
    // connector.setPort(port);
    // }
    // }
    Handler handler = server.getHandler();
    if (handler != null && handler instanceof WebAppContext) {
        WebAppContext webAppContext = (WebAppContext) handler;
        webAppContext.setResourceBase(JettyEmbedServer.class.getResource("/webapp").toString());
    }
    server.start();
    if (logger.isInfoEnabled()) {
        logger.info("##Jetty Embed Server is startup!");
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:JettyEmbedServer.java

示例5: init

import org.eclipse.jetty.util.resource.Resource; //导入方法依赖的package包/类
/**
 * Inits the system by creating a new server and handler
 */
private void init() {
    try {
        if (useConfigFile) {
            Resource resource = Resource.newSystemResource(_configFile);

            XmlConfiguration config = new XmlConfiguration(resource.getInputStream());
            _server = (Server) config.configure();

            _handler = new HttpHandler();
            _server.setHandler(_handler);
        } else {
            _server = new Server();
            _handler = new HttpHandler();
            _server.setHandler(_handler);
        }
    } catch(Exception e){
        throw new RuntimeException("Server unable to start: " + e.getMessage());
    }
}
 
开发者ID:tOgg1,项目名称:WS-Nu,代码行数:23,代码来源:ApplicationServer.java


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