本文整理了Java中io.vertx.core.VertxOptions.setFileResolverCachingEnabled()
方法的一些代码示例,展示了VertxOptions.setFileResolverCachingEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.setFileResolverCachingEnabled()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:setFileResolverCachingEnabled
[英]Set whether the Vert.x file resolver uses caching for classpath resources. Deprecated. Use FileSystemOptions instead.
[中]设置是否垂直。x文件解析器对类路径资源使用缓存。不赞成。改用文件系统选项。
代码示例来源:origin: eclipse-vertx/vert.x
case "fileResolverCachingEnabled":
if (member.getValue() instanceof Boolean) {
obj.setFileResolverCachingEnabled((Boolean)member.getValue());
代码示例来源:origin: eclipse-vertx/vert.x
private void testCaching(boolean enabled) throws Exception {
VertxInternal vertx = (VertxInternal) Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(enabled));
File tmp = File.createTempFile("vertx", ".bin");
tmp.deleteOnExit();
URL url = tmp.toURI().toURL();
Files.write(tmp.toPath(), "foo".getBytes());
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(new ClassLoader() {
@Override
public URL getResource(String name) {
if ("foo".equals(name)) {
return url;
}
return super.getResource(name);
}
});
File f = vertx.resolveFile("foo");
assertEquals("foo", new String(Files.readAllBytes(f.toPath())));
Files.write(tmp.toPath(), "bar".getBytes());
f = vertx.resolveFile("foo");
if (enabled) {
assertEquals("foo", new String(Files.readAllBytes(f.toPath())));
} else {
assertEquals("bar", new String(Files.readAllBytes(f.toPath())));
}
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testResolveFileFromClasspathDisableCaching() throws Exception {
VertxInternal vertx = (VertxInternal) Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
try {
for (int i = 0; i < 2; i++) {
File file = vertx.resolveFile("afile.html");
assertTrue(file.exists());
assertTrue(file.getPath().startsWith(".vertx" + File.separator + "file-cache-"));
assertFalse(file.isDirectory());
assertEquals("<html><body>afile</body></html>", readFile(file));
}
} finally {
vertx.close();
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testNullFileSystemOptions() {
VertxOptions options = new VertxOptions().setFileSystemOptions(null);
options.isFileResolverCachingEnabled();
options.setFileResolverCachingEnabled(true);
}
}
代码示例来源:origin: io.vertx/vertx-core
case "fileResolverCachingEnabled":
if (member.getValue() instanceof Boolean) {
obj.setFileResolverCachingEnabled((Boolean)member.getValue());
代码示例来源:origin: io.vertx/vertx-core
private void testCaching(boolean enabled) throws Exception {
VertxInternal vertx = (VertxInternal) Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(enabled));
File tmp = File.createTempFile("vertx", ".bin");
tmp.deleteOnExit();
URL url = tmp.toURI().toURL();
Files.write(tmp.toPath(), "foo".getBytes());
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(new ClassLoader() {
@Override
public URL getResource(String name) {
if ("foo".equals(name)) {
return url;
}
return super.getResource(name);
}
});
File f = vertx.resolveFile("foo");
assertEquals("foo", new String(Files.readAllBytes(f.toPath())));
Files.write(tmp.toPath(), "bar".getBytes());
f = vertx.resolveFile("foo");
if (enabled) {
assertEquals("foo", new String(Files.readAllBytes(f.toPath())));
} else {
assertEquals("bar", new String(Files.readAllBytes(f.toPath())));
}
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
options.setQuorumSize(quorumSize);
options.setHAGroup(haGroup);
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testResolveFileFromClasspathDisableCaching() throws Exception {
VertxInternal vertx = (VertxInternal) Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
try {
for (int i = 0; i < 2; i++) {
File file = vertx.resolveFile("afile.html");
assertTrue(file.exists());
assertTrue(file.getPath().startsWith(".vertx" + File.separator + "file-cache-"));
assertFalse(file.isDirectory());
assertEquals("<html><body>afile</body></html>", readFile(file));
}
} finally {
vertx.close();
}
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testNullFileSystemOptions() {
VertxOptions options = new VertxOptions().setFileSystemOptions(null);
options.isFileResolverCachingEnabled();
options.setFileResolverCachingEnabled(true);
}
}
代码示例来源:origin: io.vertx/vertx-web-templ-freemarker
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
}
代码示例来源:origin: io.vertx/vertx-web-templ-jade
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
}
代码示例来源:origin: io.vertx/vertx-web-templ-mvel
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
}
代码示例来源:origin: io.vertx/vertx-web-templ-thymeleaf
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(true));
}
代码示例来源:origin: io.vertx/vertx-web-templ-freemarker
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(true));
}
代码示例来源:origin: io.vertx/vertx-web-templ-jade
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(true));
}
代码示例来源:origin: io.vertx/vertx-web-templ-mvel
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(true));
}
代码示例来源:origin: io.vertx/vertx-web-templ-pebble
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
}
代码示例来源:origin: io.vertx/vertx-web-templ-thymeleaf
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(false));
}
代码示例来源:origin: io.vertx/vertx-web-templ-pebble
@BeforeClass
public static void before() {
vertx = Vertx.vertx(new VertxOptions().setFileResolverCachingEnabled(true));
}
代码示例来源:origin: io.vertx/vertx-core
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
options.setQuorumSize(quorumSize);
options.setHAGroup(haGroup);
内容来源于网络,如有侵权,请联系作者删除!