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