本文整理汇总了Java中org.eclipse.jetty.util.resource.JarResource类的典型用法代码示例。如果您正苦于以下问题:Java JarResource类的具体用法?Java JarResource怎么用?Java JarResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JarResource类属于org.eclipse.jetty.util.resource包,在下文中一共展示了JarResource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureDocumentRoot
import org.eclipse.jetty.util.resource.JarResource; //导入依赖的package包/类
private void configureDocumentRoot(WebAppContext handler) {
File root = getValidDocumentRoot();
root = (root != null ? root : createTempDir("jetty-docbase"));
try {
if (!root.isDirectory()) {
Resource resource = JarResource
.newJarResource(Resource.newResource(root));
handler.setBaseResource(resource);
}
else {
handler.setBaseResource(Resource.newResource(root.getCanonicalFile()));
}
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:JettyEmbeddedServletContainerFactory.java
示例2: getDirectoryResource
import org.eclipse.jetty.util.resource.JarResource; //导入依赖的package包/类
/** Returns a resource for the directory. */
Resource getDirectoryResource(String directory, boolean isInJar,
File installRootDirectory) {
if (isInJar) {
try {
return JarResource.newJarResource(Resource
.newResource(Servlet.class.getClassLoader()
.getResource(directory)));
} catch (final IOException e) {
}
return null;
} else {
return Resource.newResource(new File(installRootDirectory,
directory));
}
}
开发者ID:ZapBlasterson,项目名称:crushpaper,代码行数:17,代码来源:Servlet.java
示例3: configureDocumentRoot
import org.eclipse.jetty.util.resource.JarResource; //导入依赖的package包/类
private void configureDocumentRoot(WebAppContext handler) {
File root = getValidDocumentRoot();
if (root != null) {
try {
if (!root.isDirectory()) {
Resource resource = JarResource
.newJarResource(Resource.newResource(root));
handler.setBaseResource(resource);
}
else {
handler.setBaseResource(
Resource.newResource(root.getCanonicalFile()));
}
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:20,代码来源:JettyEmbeddedServletContainerFactory.java
示例4: startTransformServer
import org.eclipse.jetty.util.resource.JarResource; //导入依赖的package包/类
private int startTransformServer() throws Exception {
URL transforms = EngineTest.class.getClassLoader().getResource(
"transforms");
if (transforms == null) {
Assert.fail();
}
int port = findFreePort();
Server fileServer = new Server(port);
ResourceHandler handler = new ResourceHandler();
MimeTypes mimeTypes = handler.getMimeTypes();
mimeTypes.addMimeMapping("json", "application/json; charset=UTF-8");
handler.setDirectoriesListed(true);
handler.setBaseResource(JarResource.newResource(transforms));
HandlerList handlers = new HandlerList();
handlers.addHandler(handler);
handlers.addHandler(new DefaultHandler());
fileServer.setHandler(handlers);
fileServer.start();
return port;
}
开发者ID:fusepoolP3,项目名称:p3-batchrefine,代码行数:28,代码来源:TestSupport.java
示例5: setupForWar
import org.eclipse.jetty.util.resource.JarResource; //导入依赖的package包/类
/**
* Setup the webapp pointing to the war file that contains this class.
*/
protected void setupForWar() {
// Identify the war file that contains this class
ProtectionDomain protectionDomain = RunWar.class.getProtectionDomain();
URL location = protectionDomain.getCodeSource().getLocation();
String warFilePath = trimToFile(location.toExternalForm());
File warFile = new File(warFilePath);
if (!warFile.exists()) {
throw new IllegalStateException("war file not found: " + warFilePath);
}
webapp.setWar(warFilePath);
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());
if (!Boolean.getBoolean("webapp.extractWar")) {
try {
webapp.setExtractWAR(false);
webapp.setBaseResource(JarResource.newJarResource(Resource.newResource(warFile)));
} catch (IOException e) {
throw new RuntimeException("Error setting base resource to:" + warFilePath, e);
}
}
if (log().isDebugEnabled()) {
ClassLoader classLoader = webapp.getClassLoader();
log().debug("webapp classLoader: " + classLoader);
if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
log().debug("webapp classLoader URLs: " + Arrays.toString(urls));
}
}
}
开发者ID:avaje-common,项目名称:avaje-jetty-runner,代码行数:36,代码来源:RunWar.java
注:本文中的org.eclipse.jetty.util.resource.JarResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论