本文整理汇总了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);
}
示例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);
}
示例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;
}