當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.getInputStream方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.util.resource.Resource.getInputStream方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.getInputStream方法的具體用法?Java Resource.getInputStream怎麽用?Java Resource.getInputStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.util.resource.Resource的用法示例。


在下文中一共展示了Resource.getInputStream方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: append

import org.eclipse.jetty.util.resource.Resource; //導入方法依賴的package包/類
protected Resource append(HttpServletRequest request, Resource resource, String path) throws IOException {
	InputStream input = resource.getInputStream();
	ByteArrayOutputStream output = new ByteArrayOutputStream();
	int i = -1;
	while ((i = input.read()) != -1) {
		output.write(i);
	}
	input.close();
	String content = output.toString();
	StringBuffer sb = new StringBuffer(content);
	resourceAppender.append(request, path, sb);
	Resource resource2 = new StringResource(sb.toString());
	// /js/jquery.min.js
	// System.err.println("HostResourceHandler getResource:");
	return resource2;
}
 
開發者ID:tanhaichao,項目名稱:leopard,代碼行數:17,代碼來源:HostResourceHandler.java

示例5: 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

示例6: 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

示例7: setKeyStoreResource

import org.eclipse.jetty.util.resource.Resource; //導入方法依賴的package包/類
/** Set the key store resource.
 * @param resource the key store resource to set
 */
public void setKeyStoreResource(Resource resource)
{
    checkNotStarted();

    try
    {
        _keyStoreInputStream = resource.getInputStream();
    }
    catch (IOException e)
    {
         throw new InvalidParameterException("Unable to get resource "+
                 "input stream for resource "+resource.toString());
    }
}
 
開發者ID:itead,項目名稱:IoTgo_Android_App,代碼行數:18,代碼來源:SslContextFactory.java

示例8: setTrustStoreResource

import org.eclipse.jetty.util.resource.Resource; //導入方法依賴的package包/類
/** Set the trust store resource.
 * @param resource the trust store resource to set
 */
public void setTrustStoreResource(Resource resource)
{
    checkNotStarted();

    try
    {
        _trustStoreInputStream = resource.getInputStream();
    }
    catch (IOException e)
    {
         throw new InvalidParameterException("Unable to get resource "+
                 "input stream for resource "+resource.toString());
    }
}
 
開發者ID:itead,項目名稱:IoTgo_Android_App,代碼行數:18,代碼來源:SslContextFactory.java


注:本文中的org.eclipse.jetty.util.resource.Resource.getInputStream方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。