支持显示上传进度,优化部分代码

This commit is contained in:
zhouxin5253@163.com 2021-01-18 22:23:30 +08:00
parent aa5dfdbe5a
commit fd12ea1e47
2 changed files with 9 additions and 7 deletions

View File

@ -119,7 +119,7 @@ public class TeambitionClientService {
return;
}
client.upload(oneUploadUrl, buffer, 0, read);
LOGGER.info("文件正在上传上传。文件名:{},当前进度:{}/{}", path, (i+1), uploadUrl.size());
LOGGER.info("文件正在上传。文件名:{},当前进度:{}/{}", path, (i+1), uploadUrl.size());
} catch (IOException e) {
throw new RuntimeException(e);

View File

@ -84,16 +84,18 @@ public class TeambitionFileSystemStore implements IWebdavStore {
LOGGER.info("setResourceContent {}", resourceUri);
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest();
String expect = request.getHeader("Expect");
// 支持大文件上传
if ("100-continue".equalsIgnoreCase(expect)) {
return 0;
}
int contentLength = request.getContentLength();
if (contentLength < 0) {
contentLength = 0;
}
if (contentLength == 0) {
String expect = request.getHeader("Expect");
// 支持大文件上传
if ("100-continue".equalsIgnoreCase(expect)) {
return 0;
}
}
teambitionClientService.uploadPre(resourceUri, contentLength, content);
return contentLength;
}