package froala.editor.utils.view; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.servlet.view.AbstractView; import egovframework.rte.fdl.cmmn.exception.EgovBizException; import froala.editor.video.StreamingUtil; /** * 동영상 View * @since 2021. 6. 18. * @author 임종호 *
 * -----------------------
 * 개정이력
 * 2021. 6. 18. 임종호 : 최초작성
 * 
*/ @Component public class VideoView extends AbstractView { private final static Logger LOGGER = LoggerFactory.getLogger(VideoView.class); @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws EgovBizException, IOException { String path = (String) request.getAttribute("path"); path = path.replaceAll("\\.", "").replaceAll("/", "").replaceAll("\\\\", ""); if (StringUtils.isEmpty(path)) { throw new EgovBizException("파일 경로가 올바르지 않습니다."); } File file = new File(path); if (!file.exists()) { throw new FileNotFoundException(); } StreamingUtil su = new StreamingUtil(); OutputStream out = response.getOutputStream(); su.streaming(file, request, response, out); } }