當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。