Commit e46bf8a8bd19d3573c68fec5822129c92841dd92
1 parent
375cd035
支持同时打war包和jar包
Showing
3 changed files
with
52 additions
and
9 deletions
pom.xml
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | <version>2.6.7</version> | 14 | <version>2.6.7</version> |
| 15 | <name>web video platform</name> | 15 | <name>web video platform</name> |
| 16 | <description>国标28181视频平台</description> | 16 | <description>国标28181视频平台</description> |
| 17 | + <packaging>${project.packaging}</packaging> | ||
| 17 | 18 | ||
| 18 | <repositories> | 19 | <repositories> |
| 19 | <repository> | 20 | <repository> |
| @@ -56,6 +57,42 @@ | @@ -56,6 +57,42 @@ | ||
| 56 | <asciidoctor.pdf.output.directory>${project.build.directory}/asciidoc/pdf</asciidoctor.pdf.output.directory> | 57 | <asciidoctor.pdf.output.directory>${project.build.directory}/asciidoc/pdf</asciidoctor.pdf.output.directory> |
| 57 | </properties> | 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 | <dependencies> | 96 | <dependencies> |
| 60 | <dependency> | 97 | <dependency> |
| 61 | <groupId>org.springframework.boot</groupId> | 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,7 +2,6 @@ package com.genersoft.iot.vmp.conf; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 3 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 4 | import com.genersoft.iot.vmp.service.IMediaServerService; | 4 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 5 | -import org.apache.catalina.connector.ClientAbortException; | ||
| 6 | import org.apache.http.HttpHost; | 5 | import org.apache.http.HttpHost; |
| 7 | import org.apache.http.HttpRequest; | 6 | import org.apache.http.HttpRequest; |
| 8 | import org.apache.http.HttpResponse; | 7 | import org.apache.http.HttpResponse; |
| @@ -15,11 +14,9 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean; | @@ -15,11 +14,9 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
| 15 | import org.springframework.context.annotation.Bean; | 14 | import org.springframework.context.annotation.Bean; |
| 16 | import org.springframework.context.annotation.Configuration; | 15 | import org.springframework.context.annotation.Configuration; |
| 17 | import org.springframework.util.ObjectUtils; | 16 | import org.springframework.util.ObjectUtils; |
| 18 | -import org.springframework.util.StringUtils; | ||
| 19 | 17 | ||
| 20 | import javax.servlet.ServletException; | 18 | import javax.servlet.ServletException; |
| 21 | import javax.servlet.http.HttpServletRequest; | 19 | import javax.servlet.http.HttpServletRequest; |
| 22 | -import javax.servlet.http.HttpServletResponse; | ||
| 23 | import java.io.IOException; | 20 | import java.io.IOException; |
| 24 | import java.net.ConnectException; | 21 | import java.net.ConnectException; |
| 25 | 22 | ||
| @@ -77,9 +74,7 @@ public class ProxyServletConfig { | @@ -77,9 +74,7 @@ public class ProxyServletConfig { | ||
| 77 | } catch (IOException ioException) { | 74 | } catch (IOException ioException) { |
| 78 | if (ioException instanceof ConnectException) { | 75 | if (ioException instanceof ConnectException) { |
| 79 | logger.error("zlm 连接失败"); | 76 | logger.error("zlm 连接失败"); |
| 80 | - } else if (ioException instanceof ClientAbortException) { | ||
| 81 | - logger.error("zlm: 用户已中断连接,代理终止"); | ||
| 82 | - } else { | 77 | + } else { |
| 83 | logger.error("zlm 代理失败: ", e); | 78 | logger.error("zlm 代理失败: ", e); |
| 84 | } | 79 | } |
| 85 | } catch (RuntimeException exception){ | 80 | } catch (RuntimeException exception){ |
| @@ -195,9 +190,7 @@ public class ProxyServletConfig { | @@ -195,9 +190,7 @@ public class ProxyServletConfig { | ||
| 195 | } catch (IOException ioException) { | 190 | } catch (IOException ioException) { |
| 196 | if (ioException instanceof ConnectException) { | 191 | if (ioException instanceof ConnectException) { |
| 197 | logger.error("录像服务 连接失败"); | 192 | logger.error("录像服务 连接失败"); |
| 198 | - } else if (ioException instanceof ClientAbortException) { | ||
| 199 | - logger.error("录像服务:用户已中断连接,代理终止"); | ||
| 200 | - } else { | 193 | + }else { |
| 201 | logger.error("录像服务 代理失败: ", e); | 194 | logger.error("录像服务 代理失败: ", e); |
| 202 | } | 195 | } |
| 203 | } catch (RuntimeException exception){ | 196 | } catch (RuntimeException exception){ |