From b010e63dc0eef0a531478868f030a4517d522985 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 09 二月 2023 14:36:04 +0800
Subject: [PATCH] 更新文档
---
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
index a6facd5..c4086b9 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
@@ -2,7 +2,6 @@
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
-import org.apache.catalina.connector.ClientAbortException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
@@ -14,11 +13,10 @@
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.ConnectException;
@@ -55,7 +53,7 @@
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
if (mediaInfo != null) {
- if (!StringUtils.isEmpty(queryStr)) {
+ if (!ObjectUtils.isEmpty(queryStr)) {
queryStr += "&secret=" + mediaInfo.getSecret();
}else {
queryStr = "secret=" + mediaInfo.getSecret();
@@ -76,9 +74,7 @@
} catch (IOException ioException) {
if (ioException instanceof ConnectException) {
logger.error("zlm 杩炴帴澶辫触");
- } else if (ioException instanceof ClientAbortException) {
- logger.error("zlm: 鐢ㄦ埛宸蹭腑鏂繛鎺ワ紝浠g悊缁堟");
- } else {
+ } else {
logger.error("zlm 浠g悊澶辫触锛� ", e);
}
} catch (RuntimeException exception){
@@ -127,7 +123,7 @@
MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/");
String mediaServerId = split[2];
- if ("default".equals(mediaServerId)) {
+ if ("default".equalsIgnoreCase(mediaServerId)) {
return mediaServerService.getDefaultMediaServer();
}else {
return mediaServerService.getOne(mediaServerId);
@@ -146,7 +142,7 @@
logger.error("[ZLM鏈嶅姟璁块棶浠g悊]锛岄敊璇細澶勭悊url淇℃伅鏃舵湭鎵惧埌娴佸獟浣撲俊鎭�=>{}", requestURI);
return url;
}
- if (!StringUtils.isEmpty(mediaInfo.getId())) {
+ if (!ObjectUtils.isEmpty(mediaInfo.getId())) {
url = url.replace(mediaInfo.getId() + "/", "");
}
return url.replace("default/", "");
@@ -173,7 +169,7 @@
MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
String remoteHost = String.format("http://%s:%s", mediaInfo.getIp(), mediaInfo.getHttpPort());
if (mediaInfo != null) {
- if (!StringUtils.isEmpty(queryStr)) {
+ if (!ObjectUtils.isEmpty(queryStr)) {
queryStr += "&remoteHost=" + remoteHost;
}else {
queryStr = "remoteHost=" + remoteHost;
@@ -194,9 +190,7 @@
} catch (IOException ioException) {
if (ioException instanceof ConnectException) {
logger.error("褰曞儚鏈嶅姟 杩炴帴澶辫触");
- } else if (ioException instanceof ClientAbortException) {
- logger.error("褰曞儚鏈嶅姟:鐢ㄦ埛宸蹭腑鏂繛鎺ワ紝浠g悊缁堟");
- } else {
+ }else {
logger.error("褰曞儚鏈嶅姟 浠g悊澶辫触锛� ", e);
}
} catch (RuntimeException exception){
@@ -245,7 +239,7 @@
MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/");
String mediaServerId = split[2];
- if ("default".equals(mediaServerId)) {
+ if ("default".equalsIgnoreCase(mediaServerId)) {
return mediaServerService.getDefaultMediaServer();
}else {
return mediaServerService.getOne(mediaServerId);
@@ -265,7 +259,7 @@
logger.error("[褰曞儚鏈嶅姟璁块棶浠g悊]锛岄敊璇細澶勭悊url淇℃伅鏃舵湭鎵惧埌娴佸獟浣撲俊鎭�=>{}", requestURI);
return url;
}
- if (!StringUtils.isEmpty(mediaInfo.getId())) {
+ if (!ObjectUtils.isEmpty(mediaInfo.getId())) {
url = url.replace(mediaInfo.getId() + "/", "");
}
return url.replace("default/", "");
--
Gitblit v1.8.0