提交 b32d537c 作者: ZhangJingKun

日志添加

上级 f8587ed7
......@@ -84,11 +84,13 @@ public class LocalFileServiceImpl implements ILocalFileService {
// check if the file size exceeds the maximum file size or is less than 0
if (fileUtility.getMaxFileSize() < fileSize || fileSize <= 0) {
Result result = Result.error("文件大小不正确!");
log.info("文件大小不正确!");
return result;
}
// check if file extension is supported by the editor
if (!fileUtility.getFileExts().contains(fileExtension)) {
Result result = Result.error("不支持的文件类型!");
log.info("不支持的文件类型!");
return result;
}
......@@ -111,6 +113,7 @@ public class LocalFileServiceImpl implements ILocalFileService {
}
// if the operation of file uploading is unsuccessful, an error occurs
Result result = Result.error("上传文件时出现问题!");
log.info("上传文件时出现问题!");
return result;
}
......@@ -193,15 +196,15 @@ public class LocalFileServiceImpl implements ILocalFileService {
public void callBack(HttpServletRequest request, HttpServletResponse response) throws IOException{
PrintWriter writer = null;
JSONObject jsonObj = null;
System.out.println("===saveeditedfile------------");
log.info("===saveeditedfile------------");
try {
writer = response.getWriter();
Scanner scanner = new Scanner(request.getInputStream()).useDelimiter("\\A");
String body = scanner.hasNext() ? scanner.next() : "";
jsonObj = (JSONObject) new JSONParser().parse(body);
System.out.println(jsonObj);
System.out.println("===saveeditedfile:" + jsonObj.get("status"));
log.info(jsonObj.toJSONString());
log.info("===saveeditedfile:" + jsonObj.get("status"));
/*
0-找不到具有密钥标识符的文档,
1-文档正在编辑,
......@@ -257,11 +260,11 @@ public class LocalFileServiceImpl implements ILocalFileService {
* 定义要与文档存储服务保存的编辑文档的链接。当状态值仅等于2或3时,存在链路。
* */
String downloadUri = (String) jsonObj.get("url");
System.out.println("====文档编辑完成,现在开始保存编辑后的文档,其下载地址为:" + downloadUri);
log.info("====文档编辑完成,现在开始保存编辑后的文档,其下载地址为:" + downloadUri);
//解析得出文件名
//String fileName = downloadUri.substring(downloadUri.lastIndexOf('/')+1);
String fileName = request.getParameter("fileName");
System.out.println("====下载的文件名:" + fileName);
log.info("====下载的文件名:" + fileName);
URL url = new URL(downloadUri);
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论