파일다운로드
-
핸들러 메소드 14부 ResponseEntity 예제:) 다운로드SPRING/스프링 MVC 2021. 7. 10. 01:58
파일 리소스를 읽어오는 방법 - 스프링 ResourceLoader 사용하기 파일 다운로드 응답 헤더에 설정할 내용 - Content-Disposition: 사용자가 해당 파일을 받을 때 사용할 파일 이름 - Content-Type: 어떤 파일인가 - Content-Length: 얼마나 큰 파일인가 파일의 종류(미디어 타입) 알아내는 방법 - http://tika.apache.org/ org.apache.tika tika-core 1.26 ResponseEntity - 응답 상태 코드 - 응답 헤더 - 응답 본문 파일 다운로드 로직 @Controller public class FileController { @Autowired private ResourceLoader resourceLoader; @GetMa..