当前位置: 首页>>代码示例>>Java>>正文


Java VirtualFile.isDirectory方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:23,代码来源:TemplateLoader.java

示例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);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ApplicationClassloader.java

示例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);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ApplicationClassloader.java

示例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);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ClassStateHashCreator.java

示例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());
                    }
                }
            }
        }
    }
 
开发者ID:eBay,项目名称:restcommander,代码行数:36,代码来源:ServletWrapper.java

示例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));
}
 
开发者ID:codeborne,项目名称:play-web,代码行数:12,代码来源:WebAdmin.java

示例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);
}
 
开发者ID:codeborne,项目名称:play-web,代码行数:14,代码来源:WebAdmin.java

示例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;
}
 
开发者ID:codeborne,项目名称:play-web,代码行数:10,代码来源:Web.java

示例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);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:46,代码来源:PlayGrizzlyAdapter.java


注:本文中的play.vfs.VirtualFile.isDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。