Commit e46bf8a8bd19d3573c68fec5822129c92841dd92

Authored by 648540858
1 parent 375cd035

支持同时打war包和jar包

... ... @@ -14,6 +14,7 @@
14 14 <version>2.6.7</version>
15 15 <name>web video platform</name>
16 16 <description>国标28181视频平台</description>
  17 + <packaging>${project.packaging}</packaging>
17 18  
18 19 <repositories>
19 20 <repository>
... ... @@ -56,6 +57,42 @@
56 57 <asciidoctor.pdf.output.directory>${project.build.directory}/asciidoc/pdf</asciidoctor.pdf.output.directory>
57 58 </properties>
58 59  
  60 + <profiles>
  61 + <profile>
  62 + <id>jar</id>
  63 + <activation>
  64 + <activeByDefault>true</activeByDefault>
  65 + </activation>
  66 + <properties>
  67 + <project.packaging>jar</project.packaging>
  68 + </properties>
  69 + </profile>
  70 + <profile>
  71 + <id>war</id>
  72 + <properties>
  73 + <project.packaging>war</project.packaging>
  74 + </properties>
  75 + <dependencies>
  76 + <dependency>
  77 + <groupId>org.springframework.boot</groupId>
  78 + <artifactId>spring-boot-starter-web</artifactId>
  79 + <exclusions>
  80 + <exclusion>
  81 + <groupId>org.springframework.boot</groupId>
  82 + <artifactId>spring-boot-starter-tomcat</artifactId>
  83 + </exclusion>
  84 + </exclusions>
  85 + </dependency>
  86 + <dependency>
  87 + <groupId>javax.servlet</groupId>
  88 + <artifactId>javax.servlet-api</artifactId>
  89 + <version>3.1.0</version>
  90 + <scope>provided</scope>
  91 + </dependency>
  92 + </dependencies>
  93 + </profile>
  94 + </profiles>
  95 +
59 96 <dependencies>
60 97 <dependency>
61 98 <groupId>org.springframework.boot</groupId>
... ...
src/main/java/com/genersoft/iot/vmp/ServletInitializer.java 0 → 100644
  1 +package com.genersoft.iot.vmp;
  2 +
  3 +import org.springframework.boot.builder.SpringApplicationBuilder;
  4 +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  5 +
  6 +public class ServletInitializer extends SpringBootServletInitializer {
  7 +
  8 + @Override
  9 + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  10 + return application.sources(VManageBootstrap.class);
  11 + }
  12 +
  13 +}
... ...
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
... ... @@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.conf;
2 2  
3 3 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
4 4 import com.genersoft.iot.vmp.service.IMediaServerService;
5   -import org.apache.catalina.connector.ClientAbortException;
6 5 import org.apache.http.HttpHost;
7 6 import org.apache.http.HttpRequest;
8 7 import org.apache.http.HttpResponse;
... ... @@ -15,11 +14,9 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean;
15 14 import org.springframework.context.annotation.Bean;
16 15 import org.springframework.context.annotation.Configuration;
17 16 import org.springframework.util.ObjectUtils;
18   -import org.springframework.util.StringUtils;
19 17  
20 18 import javax.servlet.ServletException;
21 19 import javax.servlet.http.HttpServletRequest;
22   -import javax.servlet.http.HttpServletResponse;
23 20 import java.io.IOException;
24 21 import java.net.ConnectException;
25 22  
... ... @@ -77,9 +74,7 @@ public class ProxyServletConfig {
77 74 } catch (IOException ioException) {
78 75 if (ioException instanceof ConnectException) {
79 76 logger.error("zlm 连接失败");
80   - } else if (ioException instanceof ClientAbortException) {
81   - logger.error("zlm: 用户已中断连接,代理终止");
82   - } else {
  77 + } else {
83 78 logger.error("zlm 代理失败: ", e);
84 79 }
85 80 } catch (RuntimeException exception){
... ... @@ -195,9 +190,7 @@ public class ProxyServletConfig {
195 190 } catch (IOException ioException) {
196 191 if (ioException instanceof ConnectException) {
197 192 logger.error("录像服务 连接失败");
198   - } else if (ioException instanceof ClientAbortException) {
199   - logger.error("录像服务:用户已中断连接,代理终止");
200   - } else {
  193 + }else {
201 194 logger.error("录像服务 代理失败: ", e);
202 195 }
203 196 } catch (RuntimeException exception){
... ...