本文整理匯總了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;
}