首先只需要在pom文件中添加打包方式
然后
点击这个就会生成在项目下生成target文件夹,下面就有war包
然后xshell连接服务器
先搞jdk环境
在/etc/profile中配置一下
然后运行下载tomcat启动
出现找不到setclasspath.sh就输入 unset CATALINA_HOME
如果访问不到tomcat 就吧服务器的防火墙给8080加入白名单
还要在阿里云控制台打开8080端口!!!
war包放在tomcat的webapps下
./startup.sh启动tomcat ./shutdown.sh关闭tomcat
在html页面显示视频
html页面
<video width="1000" height="700" controls="controls">
<source src="three" type="video/mp4">
控制器
@RequestMapping("three")
public void c(HttpServletResponse response) throws IOException {
File file = new File("/usr/local/2.mp4");//linux路径
FileInputStream fileInputStream = new FileInputStream(file);
response.addHeader("Content-Type","video/mp4;charset=UTF-8");
IOUtils.copy(fileInputStream,response.getOutputStream());
response.flushBuffer();
}