替换绝对路径为空
String str = new ActionEnter(request, buffer.toString(), "config.json").exec(); String action = request.getParameter("action"); String rootPath =buffer.toString(); if( action!=null && (action.equals("listfile") || action.equals("listimage") ) ){ rootPath = rootPath.replace("\", "/"); rootPath = rootPath.replace("//", "/"); str = str.replaceAll(rootPath, ""); } JSONObject json =JSONObject.parseObject(str);