当前位置: 首页>>代码示例>>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;未经允许,请勿转载。