获取页面
@param dir 所在目录
@param viewPath view路径
@param pageName view名字
@return
492097
public static String getJSPPageView(String dir, String viewPath, String pageName){
		return getPageView(dir, viewPath, pageName, JSP);
	}
1248961
public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
	    throws PageException {
	// check directory
	SecurityManager securityManager = pc.getConfig().getSecurityManager();
	securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);

	if (!directory.exists()) throw new ApplicationException("the directory [" + directory.toString() + "] doesn't exist");
	if (!directory.isDirectory()) throw new ApplicationException("the file [" + directory.toString() + "] exists, but it isn't a directory");
	if (!directory.canRead()) throw new ApplicationException("no access to read directory [" + directory.toString() + "]");

	if (strNewdirectory == null) throw new ApplicationException("the attribute [newDirectory] is not defined");

	// real to source
	Resource newdirectory = toDestination(pc, strNewdirectory, directory);

	securityManager.checkFileLocation(pc.getConfig(), newdirectory, serverPassword);
	if (newdirectory.exists()) throw new ApplicationException("new directory [" + newdirectory.toString() + "] already exists");
	if (createPath) {
	    newdirectory.getParentResource().mkdirs();

	}
	try {
	    directory.moveTo(newdirectory);
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    throw Caster.toPageException(t);
	}

	// set S3 stuff
	setS3Attrs(pc, directory, acl, storage);

    }
1204268
public static Collection<Link> getViewLinks(View view, Page page) throws ServletException, IOException {
		return view.getLinks(
			getServletContext(),
			getRequest(),
			getResponse(),
			page
		);
	}
1101887
private function getPathForView()
    {
        $methodName = lcfirst($this->method);
        $className = lcfirst($this->class);

        $package = $this->app->getPackage($this->package);
        $pathPieces = array($package['package_path'], 'res', 'view', $className, $methodName);
        $path = implode(self::DS, $pathPieces) . '.phtml';
        if (file_exists($path)) {
            return $path;
        }
        $e = new ViewFileNotFoundException('Invalid view file path, expected: "' . $path . '"');
        $e->setAdditionalData('View Path Checked: ', $path);
        throw $e;
    }
1371424
public File[] listFiles(String directoryPath) {
        File[] result = null;
        File directory = null;
        directory = new File(directoryPath);
        if (directory.isDirectory()) {
            result = directory.listFiles();
        }
        return result;
    }
752021
function (filePath, model) {
            filePath = getFileWithExt(filePath);
            filePath = path.join(configure.partialViewDir, filePath);
            var partialTemp = saker.getView(filePath);
            try {
                var html = saker.compile(partialTemp, filePath).call({
                    layout: null
                }, model);
            } catch (err) {
                throw err;
            }
            return html;
        }
448324
function toRoute (pageDir, entry) {
  const page = '/' + relative(pageDir, entry)
  let base = page.split(extname(page)).join('')
  if (base[0] === '/') {
    base = base.substring(1)
  }
  if (base === 'index') {
    const dir = dirname(page)
    return dir + base
  } else {
    return '/' + base
  }
}
666192
public static String linkForToolPath(CmsJspActionElement jsp, String toolPath) {

        StringBuffer result = new StringBuffer();
        result.append(jsp.link(VIEW_JSPPAGE_LOCATION));
        result.append('?');
        result.append(CmsToolDialog.PARAM_PATH);
        result.append('=');
        result.append(CmsEncoder.encode(toolPath));
        return result.toString();
    }
849780
public static String calculateViewId(FacesContext context) {
        Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
        String viewId = (String) requestMap.get("javax.servlet.include.path_info");

        if (viewId == null) {
            viewId = context.getExternalContext().getRequestPathInfo();
        }

        if (viewId == null) {
            viewId = (String) requestMap.get("javax.servlet.include.servlet_path");
        }

        if (viewId == null) {
            viewId = context.getExternalContext().getRequestServletPath();
        }

        return viewId;
    }
734239
public static List<Document> convert2DocumentList(String folderPath, boolean verbose)
    {
        long start = System.currentTimeMillis();
        List<File> fileList = IOUtil.fileList(folderPath);
        List<Document> documentList = new LinkedList<Document>();
        int i = 0;
        for (File file : fileList)
        {
            if (verbose) System.out.print(file);
            Document document = convert2Document(file);
            documentList.add(document);
            if (verbose) System.out.println(" " + ++i + " / " + fileList.size());
        }
        if (verbose)
        {
            System.out.println(documentList.size());
            System.out.printf("花费时间%d ms\n", System.currentTimeMillis() - start);
        }
        return documentList;
    }
43282
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {

		Collection<String> paths = StringSupport.split(classPath, ";:", false);

		for(String singlePath : paths) {
			File dir = new File(singlePath);
			if (dir.isDirectory()) {
				File file = new File(singlePath + '/' + fileName);
				if (file.exists()) {
					return file;
				}
			}
		}
		return null;
	}
365371
function Template( name, dir){
  this.name = name;
  if( name){
    this.view = this.load( 
      util.format(
        '%s/%s/%s.%s', 
        dir, name, name, 'html'
      )
    );
  }
  return this;
}
815122
private static String recursiveSearch(java.io.File dir, String fileName) {
        for (String name : dir.list()) {
            java.io.File file = new java.io.File(dir.getAbsolutePath() + "/" + name);
            if (name.compareTo(fileName) == 0) return file.getAbsolutePath();
            if (file.isDirectory()) {
                String filePath = recursiveSearch(file, fileName);
                if (filePath != null) return filePath;
            }
        }

        return null;
    }
721759
function getPageName (pageDir, entry) {
  const page = '/' + relative(pageDir, entry)
  let base = page.split(extname(page)).join('')
  if (base[0] === '/') {
    base = base.substring(1)
  }
  if (base === 'index') {
    const dir = basename(dirname(page))
    return dir === '' ? 'index' : dir
  } else {
    return base
  }
}
1048813
private String buildUrl( String methodPath, CPath path )
    {
        StringBuilder sb = new StringBuilder();

        sb.append( END_POINT ).append( '/' ).append( methodPath );

        if ( path != null ) {
            sb.append( '/' ).append( scope ).append( path.getUrlEncoded() );
        }

        return sb.toString();
    }
819336
private <F extends FileDescriptor> void scanPath(MavenProjectDirectoryDescriptor projectDescriptor, String path, Scope scope, Scanner scanner) {
        File file = new File(path);
        if (!file.exists()) {
            LOGGER.debug(file.getAbsolutePath() + " does not exist, skipping.");
        } else {
            F fileDescriptor = scanFile(projectDescriptor, file, path, scope, scanner);
            if (fileDescriptor != null) {
                projectDescriptor.getContains().add(fileDescriptor);
            }
        }
    }
697166
public String getViewPath(String className, String methodName, String viewName) {
    if (Strings.isNotEmpty(viewName)) {
      if (viewName.charAt(0) == Constants.separator) { return viewName; }
    }
    Profile profile = profileServie.getProfile(className);
    if (null == profile) { throw new RuntimeException("no convention profile for " + className); }
    StringBuilder buf = new StringBuilder();
    if (profile.getViewPathStyle().equals(Constants.FULL_VIEWPATH)) {
      buf.append(Constants.separator);
      buf.append(profile.getFullPath(className));
    } else if (profile.getViewPathStyle().equals(Constants.SIMPLE_VIEWPATH)) {
      buf.append(profile.getViewPath());
      // 添加中缀路径
      buf.append(profile.getInfix(className));
    } else if (profile.getViewPathStyle().equals(Constants.SEO_VIEWPATH)) {
      buf.append(profile.getViewPath());
      buf.append(Strings.unCamel(profile.getInfix(className)));
    } else {
      throw new RuntimeException(profile.getViewPathStyle() + " was not supported");
    }
    // add method mapping path
    buf.append(Constants.separator);
    if (Strings.isEmpty(viewName) || viewName.equals("success")) {
      viewName = methodName;
    }

    if (null == methodViews.get(viewName)) {
      buf.append(viewName);
    } else {
      buf.append(methodViews.get(viewName));
    }
    return buf.toString();
  }