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


Java ResourceHandler.setMinMemoryMappedContentLength方法代码示例

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


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

示例1: addResources

import org.eclipse.jetty.server.handler.ResourceHandler; //导入方法依赖的package包/类
public void addResources(String contextPath, String resourcePath, String welcomesCsv) {
	int opt = ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS;
	ServletContextHandler context = new ServletContextHandler(opt);
	{
		context.setContextPath(contextPath);
		context.setCompactPath(true);
		context.setAllowNullPathInfo(true);

		if (Resources.exists(resourcePath)) {
			URL url = Resources.getURL(resourcePath);
			context.setResourceBase(url.toExternalForm());
		}
		ResourceHandler h = new ResourceHandler();
		h.setMinMemoryMappedContentLength(-1);
		h.setEtags(true);
		context.setHandler(h);
		context.setWelcomeFiles(Iterables.toArray(Splitters.notEmpties(",").split(welcomesCsv), String.class));
	}
	this.handlers.addHandler(context);
}
 
开发者ID:dohbot,项目名称:knives,代码行数:21,代码来源:EmbeddedJetty.java

示例2: initWebApp

import org.eclipse.jetty.server.handler.ResourceHandler; //导入方法依赖的package包/类
private void initWebApp() {
    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setResourceBase(config.getString("web.path"));
    if (config.getBoolean("web.debug")) {
        resourceHandler.setWelcomeFiles(new String[] {"debug.html", "index.html"});
        resourceHandler.setMinMemoryMappedContentLength(-1); // avoid locking files on Windows
    } else {
        String cache = config.getString("web.cacheControl");
        if (cache != null && !cache.isEmpty()) {
            resourceHandler.setCacheControl(cache);
        }
        resourceHandler.setWelcomeFiles(new String[] {"release.html", "index.html"});
    }
    handlers.addHandler(resourceHandler);
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:16,代码来源:WebServer.java

示例3: createContextHandler

import org.eclipse.jetty.server.handler.ResourceHandler; //导入方法依赖的package包/类
/** Creates a context handler for the directory. */
private ContextHandler createContextHandler(String directory,
		boolean isInJar, File installRootDirectory, int expiresInSeconds) {
	final ContextHandler contextHandler = new ContextHandler();
	final ResourceHandler resourceHandler = new ExpiresResourceHandler(expiresInSeconds);
	final String directoryWithSlash = "/" + directory;
	contextHandler.setContextPath(directoryWithSlash);

	Resource directoryResource = getDirectoryResource(directory, isInJar,
			installRootDirectory);
	directoryResource = new JsMinifyingResource(directoryResource);

	if (isInJar) {
		directoryResource = new CachingResource(directoryResource,
				directoryWithSlash);
	}

	resourceHandler.setBaseResource(directoryResource);

	if (!isInJar) {
		// This makes development easier because Eclipse can copy files
		// to the target directory on each save on Windows.
		resourceHandler.setMinMemoryMappedContentLength(0);
	}

	contextHandler.setHandler(resourceHandler);

	return contextHandler;
}
 
开发者ID:ZapBlasterson,项目名称:crushpaper,代码行数:30,代码来源:Servlet.java


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