支持显示上传进度,优化部分代码
This commit is contained in:
parent
aa5dfdbe5a
commit
fd12ea1e47
|
@ -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);
|
||||
|
|
|
@ -84,15 +84,17 @@ public class TeambitionFileSystemStore implements IWebdavStore {
|
|||
LOGGER.info("setResourceContent {}", resourceUri);
|
||||
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = requestAttributes.getRequest();
|
||||
int contentLength = request.getContentLength();
|
||||
if (contentLength < 0) {
|
||||
contentLength = 0;
|
||||
}
|
||||
if (contentLength == 0) {
|
||||
String expect = request.getHeader("Expect");
|
||||
|
||||
// 支持大文件上传
|
||||
if ("100-continue".equalsIgnoreCase(expect)) {
|
||||
return 0;
|
||||
}
|
||||
int contentLength = request.getContentLength();
|
||||
if (contentLength < 0) {
|
||||
contentLength = 0;
|
||||
}
|
||||
teambitionClientService.uploadPre(resourceUri, contentLength, content);
|
||||
return contentLength;
|
||||
|
|
Loading…
Reference in New Issue