Commit f3dafd7a authored by Administrator's avatar Administrator

增加删除文件接口

parent 3e0d3d51
...@@ -53,9 +53,23 @@ public class FileExploreHandler implements SekiroRequestHandler { ...@@ -53,9 +53,23 @@ public class FileExploreHandler implements SekiroRequestHandler {
handlePost(sekiroRequest, sekiroResponse, targetFile); handlePost(sekiroRequest, sekiroResponse, targetFile);
} else if ("put".equalsIgnoreCase(op)) { } else if ("put".equalsIgnoreCase(op)) {
handlePut(sekiroRequest, sekiroResponse, targetFile); handlePut(sekiroRequest, sekiroResponse, targetFile);
} else if ("delete".equalsIgnoreCase(op)) {
handleDelete(sekiroResponse, targetFile);
} }
} }
private void handleDelete(SekiroResponse sekiroResponse, File targetFile) {
if (!targetFile.isFile() || !targetFile.exists()) {
sekiroResponse.failed("filed not exist");
}
if (targetFile.delete()) {
sekiroResponse.success("success");
} else {
sekiroResponse.failed("remove failed");
}
}
private void handleGet(SekiroRequest sekiroRequest, SekiroResponse sekiroResponse, File targetFile) { private void handleGet(SekiroRequest sekiroRequest, SekiroResponse sekiroResponse, File targetFile) {
if (targetFile.isDirectory()) { if (targetFile.isDirectory()) {
List<String> ret = new ArrayList<>(); List<String> ret = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment