功能
一. Js 图片等资源文件的上传和使用
(1)文件搜索 文件资源树展示 http://127.0.0.1:8080/fileTree
核心代码1:java获取文件树
public JSONArray getFileTree(File filepath,String pathSuffix,String dev) throws UnsupportedEncodingException {
fileTree = new FileTree();
jsonArray = new JSONArray();
if (dev.equals("local")){
IPSuffix = "http://127.0.0.1:8080";
}
if (dev.equals("remote")){
IPSuffix = "http://10.227.13.114:8080";
}
this.pathSuffix = pathSuffix;
getEntityFileTree(filepath,fileTree);
getJsonFileTree(fileTree,jsonArray);
return jsonArray;
}
private void getEntityFileTree(File filepath,FileTree fileTree){
if (filepath.exists() == false) {
return;
}else {
fileTree.name = filepath.getName();
fileTree.route = filepath.getAbsolutePath().replaceAll(pathSuffix,"").replaceAll("/"+fileTree.name,"");
fileTree.isDir = filepath.isDirectory();
}
//获取文件夹下的所有文件和文件夹
if ( filepath.isDirectory() && filepath.listFiles().length != 0)
{
for (File file : filepath.lis