本文整理汇总了Java中play.vfs.VirtualFile.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFile.isDirectory方法的具体用法?Java VirtualFile.isDirectory怎么用?Java VirtualFile.isDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.vfs.VirtualFile
的用法示例。
在下文中一共展示了VirtualFile.isDirectory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scan
import play.vfs.VirtualFile; //导入方法依赖的package包/类
private static void scan(List<Template> templates, VirtualFile current) {
if (!current.isDirectory() && !current.getName().startsWith(".") && !current.getName().endsWith(".scala.html")) {
long start = System.currentTimeMillis();
Template template = load(current);
if (template != null) {
try {
template.compile();
if (Logger.isTraceEnabled()) {
Logger.trace("%sms to load %s", System.currentTimeMillis() - start, current.getName());
}
} catch (TemplateCompilationException e) {
Logger.error("Template %s does not compile at line %d", e.getTemplate().name, e.getLineNumber());
throw e;
}
templates.add(template);
}
} else if (current.isDirectory() && !current.getName().startsWith(".")) {
for (VirtualFile virtualFile : current.list()) {
scan(templates, virtualFile);
}
}
}
示例2: scan
import play.vfs.VirtualFile; //导入方法依赖的package包/类
void scan(List<ApplicationClass> classes, String packageName, VirtualFile current) {
if (!current.isDirectory()) {
if (current.getName().endsWith(".java") && !current.getName().startsWith(".")) {
String classname = packageName + current.getName().substring(0, current.getName().length() - 5);
classes.add(Play.classes.getApplicationClass(classname));
}
} else {
for (VirtualFile virtualFile : current.list()) {
scan(classes, packageName + current.getName() + ".", virtualFile);
}
}
}
示例3: scanPrecompiled
import play.vfs.VirtualFile; //导入方法依赖的package包/类
void scanPrecompiled(List<ApplicationClass> classes, String packageName, VirtualFile current) {
if (!current.isDirectory()) {
if (current.getName().endsWith(".class") && !current.getName().startsWith(".")) {
String classname = packageName.substring(5) + current.getName().substring(0, current.getName().length() - 6);
classes.add(new ApplicationClass(classname));
}
} else {
for (VirtualFile virtualFile : current.list()) {
scanPrecompiled(classes, packageName + current.getName() + ".", virtualFile);
}
}
}
示例4: scan
import play.vfs.VirtualFile; //导入方法依赖的package包/类
private void scan(StringBuffer buf, VirtualFile current) {
if (!current.isDirectory()) {
if (current.getName().endsWith(".java")) {
buf.append( getClassDefsForFile(current));
}
} else if (!current.getName().startsWith(".")) {
// TODO: we could later optimizie it further if we check if the entire folder is unchanged
for (VirtualFile virtualFile : current.list()) {
scan(buf, virtualFile);
}
}
}
示例5: serveStatic
import play.vfs.VirtualFile; //导入方法依赖的package包/类
public void serveStatic(HttpServletResponse servletResponse, HttpServletRequest servletRequest, RenderStatic renderStatic) throws IOException {
VirtualFile file = Play.getVirtualFile(renderStatic.file);
if (file == null || file.isDirectory() || !file.exists()) {
serve404(servletRequest, servletResponse, new NotFound("The file " + renderStatic.file + " does not exist"));
} else {
servletResponse.setContentType(MimeTypes.getContentType(file.getName()));
boolean raw = Play.pluginCollection.serveStatic(file, Request.current(), Response.current());
if (raw) {
copyResponse(Request.current(), Response.current(), servletRequest, servletResponse);
} else {
if (Play.mode == Play.Mode.DEV) {
servletResponse.setHeader("Cache-Control", "no-cache");
servletResponse.setHeader("Content-Length", String.valueOf(file.length()));
if (!servletRequest.getMethod().equals("HEAD")) {
copyStream(servletResponse, file.inputstream());
} else {
copyStream(servletResponse, new ByteArrayInputStream(new byte[0]));
}
} else {
long last = file.lastModified();
String etag = "\"" + last + "-" + file.hashCode() + "\"";
if (!isModified(etag, last, servletRequest)) {
servletResponse.setHeader("Etag", etag);
servletResponse.setStatus(304);
} else {
servletResponse.setHeader("Last-Modified", Utils.getHttpDateFormatter().format(new Date(last)));
servletResponse.setHeader("Cache-Control", "max-age=" + Play.configuration.getProperty("http.cacheControl", "3600"));
servletResponse.setHeader("Etag", etag);
copyStream(servletResponse, file.inputstream());
}
}
}
}
}
示例6: history
import play.vfs.VirtualFile; //导入方法依赖的package包/类
public void history(String path) throws InterruptedException, IOException, ExecException {
validateGitPaths(path);
WebPage page = WebPage.forPath(path);
List<String> args = new ArrayList<>(asList("log", "--pretty=format:%h%x09%ct%x09%an%x09%ae%x09%s%x09%b%x03", "--max-count=50"));
if (path.startsWith("/")) path = path.substring(1);
for (VirtualFile file : page.dir.list()) {
if (!file.isDirectory()) args.add(path + file.getName());
}
String[] log = git(args).split("\u0003");
renderTemplate(ImmutableMap.of("page", page, "log", log));
}
示例7: restore
import play.vfs.VirtualFile; //导入方法依赖的package包/类
public void restore(String path, String revision) throws InterruptedException, IOException, ExecException {
checkAuthenticity();
validateGitPaths(path);
WebPage page = WebPage.forPath(path);
List<String> args = new ArrayList<>(asList("checkout", revision, "--"));
if (path.startsWith("/")) path = path.substring(1);
for (VirtualFile file : page.dir.list()) {
if (!file.isDirectory()) args.add(path + file.getName());
}
git(args);
logger.info("Restored " + page.path + " to " + revision);
redirect(page.path);
}
示例8: serveFileOrGetDirectory
import play.vfs.VirtualFile; //导入方法依赖的package包/类
private VirtualFile serveFileOrGetDirectory() throws IOException, ParseException {
VirtualFile file = WebPage.toVirtualFile(URLDecoder.decode(request.path, "UTF-8"));
if (file.exists() && isAllowed(file)) {
Http.Response.current().cacheFor("30d");
renderBinary(file.getRealFile());
}
else if (!file.isDirectory()) showNotFoundError();
return file;
}
示例9: serveStatic
import play.vfs.VirtualFile; //导入方法依赖的package包/类
public void serveStatic(GrizzlyRequest grizzlyRequest, GrizzlyResponse grizzlyResponse, RenderStatic renderStatic) {
VirtualFile file = Play.getVirtualFile(renderStatic.file);
if (file == null || file.isDirectory() || !file.exists()) {
serve404(grizzlyRequest, grizzlyResponse, new NotFound("The file " + renderStatic.file + " does not exist"));
} else {
grizzlyResponse.setContentType(MimeTypes.getContentType(file.getName()));
boolean raw = false;
for (PlayPlugin plugin : Play.plugins) {
if (plugin.serveStatic(file, Request.current(), Response.current())) {
raw = true;
break;
}
}
try {
if (raw) {
copyResponse(Request.current(), Response.current(), grizzlyRequest, grizzlyResponse);
} else {
if (Play.mode == Play.Mode.DEV) {
grizzlyResponse.setHeader("Cache-Control", "no-cache");
grizzlyResponse.setHeader("Content-Length", String.valueOf(file.length()));
if (!grizzlyRequest.getMethod().equals("HEAD")) {
copyStream(grizzlyResponse, file.inputstream());
} else {
copyStream(grizzlyResponse, new ByteArrayInputStream(new byte[0]));
}
} else {
long last = file.lastModified();
String etag = "\"" + last + "-" + file.hashCode() + "\"";
if (!isModified(etag, last, grizzlyRequest)) {
grizzlyResponse.setHeader("Etag", etag);
grizzlyResponse.setStatus(304);
} else {
grizzlyResponse.setHeader("Last-Modified", Utils.getHttpDateFormatter().format(new Date(last)));
grizzlyResponse.setHeader("Cache-Control", "max-age=" + Play.configuration.getProperty("http.cacheControl", "3600"));
grizzlyResponse.setHeader("Etag", etag);
copyStream(grizzlyResponse, file.inputstream());
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}