|
@@ -4,6 +4,7 @@ import cn.hutool.core.io.IoUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
|
import cn.newfeifan.mall.framework.common.util.json.JsonUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.context.request.RequestAttributes;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
@@ -26,6 +27,7 @@ import java.util.Map;
|
|
|
*
|
|
|
* @author 非繁源码
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
public class ServletUtils {
|
|
|
|
|
|
/**
|
|
@@ -73,6 +75,7 @@ public class ServletUtils {
|
|
|
public static void transfer(byte[] content, String reqRange, HttpServletResponse response){
|
|
|
try {
|
|
|
File sf = fileTransition(content);
|
|
|
+ log.info("=====file文件:{}",sf);
|
|
|
RspInfo ri= getPartFileRsp( sf, reqRange) ;
|
|
|
response.setContentLength((int)ri.content_Length);
|
|
|
response.setHeader("Content-Range", ri.content_Range);
|
|
@@ -154,6 +157,7 @@ public class ServletUtils {
|
|
|
public static File fileTransition(byte[] content) throws IOException{
|
|
|
File file = new File("data/file/videoTest.mp4");
|
|
|
if(!file.exists()){
|
|
|
+ log.info("=====创建文件");
|
|
|
file.mkdir();
|
|
|
}
|
|
|
Files.write(Paths.get("data/file/videoTest.mp4"), content);
|