대용량 다운로드 수정 #70
@@ -30,7 +30,6 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.coyote.BadRequestException;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -384,13 +383,11 @@ public class LabelAllocateApiController {
|
|||||||
public ResponseEntity<Resource> download(
|
public ResponseEntity<Resource> download(
|
||||||
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
|
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
//
|
||||||
if (!labelAllocateService.isDownloadable(uuid)) {
|
// if (!labelAllocateService.isDownloadable(uuid)) {
|
||||||
throw new BadRequestException();
|
// throw new BadRequestException();
|
||||||
}
|
// }
|
||||||
long t = System.currentTimeMillis();
|
|
||||||
String uid = labelAllocateService.findLearnUid(uuid);
|
String uid = labelAllocateService.findLearnUid(uuid);
|
||||||
log.info("findLearnUid took {} ms", System.currentTimeMillis() - t);
|
|
||||||
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
||||||
long size = Files.size(zipPath);
|
long size = Files.size(zipPath);
|
||||||
Resource resource = new org.springframework.core.io.UrlResource(zipPath.toUri());
|
Resource resource = new org.springframework.core.io.UrlResource(zipPath.toUri());
|
||||||
|
|||||||
Reference in New Issue
Block a user