DEXTUploadJK 설정

Home > 설정 > 문서 02

설명

Spring Boot는 파일 업로드를 처리하는 기본 기능을 내장하고 있기 때문에, DEXTUploadJK를 사용하려면 Spring Boot의 파일 업로드 기능을 비활성해야 한다.

Spring Boot의 파일 업로드를 기능을 비활성화 하는 방법은 두 가지이다.

기본 기능을 사용하지 않도록 설정했다면, DEXTUploadJK를 설정할 차례이다. 샘플은 DEXTUploadX5와 DEXTUploadJK 두 제품을 연동하여 대용량 파일 업로드 기능까지 처리를 하고 있기 때문에 JKSpringExtensionUploadFilter를 사용해야 한다. JKSpringExtensionUploadFilter은 대용량 파일 업로드 및 일반 파일 업로드까지 모두 처리가 가능하다.

샘플에서는 SampleConfiguration에서 다음과 같이 필터를 설정하였다.

@Bean
FilterRegistrationBean<JKSpringExtensionUploadFilter> filterRegistrationBean(ServletContext context) {
    FilterRegistrationBean<JKSpringExtensionUploadFilter> fb = new FilterRegistrationBean<JKSpringExtensionUploadFilter>();
    fb.addInitParameter("tempRepository", context.getRealPath("/files/temp"));
    fb.addInitParameter("defaultRepository", context.getRealPath("/files/store"));
    fb.addInitParameter("autoMakingDirectory", "true");
    fb.addInitParameter("enableCleaner", "true");
    fb.addInitParameter("whiteExtension", "jpg,gif,png,doc,xls,ppt,docx,xlsx,pptx,pdf,txt,zip,hwp,mp4");
    fb.addInitParameter("licenseFilePath", context.getRealPath("/license/dextuploadjk.config"));		
    fb.setFilter(new JKSpringExtensionUploadFilter());
    fb.setDispatcherTypes(DispatcherType.REQUEST);
    fb.addUrlPatterns(           
            "/upload-files",
            "/upload-extension");		
    return fb;
}