修正用户停止播放后API代理抛错误问题
This commit is contained in:
parent
a62e5699b5
commit
04f31d53a4
@ -2,8 +2,7 @@ package com.genersoft.iot.vmp.conf;
|
|||||||
|
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.catalina.connector.ClientAbortException;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -14,16 +13,11 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletRequest;
|
|
||||||
import javax.servlet.ServletResponse;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ProxyServletConfig {
|
public class ProxyServletConfig {
|
||||||
|
|
||||||
@ -61,7 +55,7 @@ public class ProxyServletConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){
|
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){
|
||||||
System.out.println(e.getMessage());
|
//System.out.println(e.getMessage());
|
||||||
try {
|
try {
|
||||||
super.handleRequestException(proxyRequest, proxyResonse, e);
|
super.handleRequestException(proxyRequest, proxyResonse, e);
|
||||||
} catch (ServletException servletException) {
|
} catch (ServletException servletException) {
|
||||||
@ -69,6 +63,8 @@ public class ProxyServletConfig {
|
|||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
if (ioException instanceof ConnectException) {
|
if (ioException instanceof ConnectException) {
|
||||||
logger.error("zlm 连接失败");
|
logger.error("zlm 连接失败");
|
||||||
|
} else if (ioException instanceof ClientAbortException) {
|
||||||
|
logger.error("用户已中断连接,代理终止");
|
||||||
} else {
|
} else {
|
||||||
logger.error("zlm 代理失败: ", e);
|
logger.error("zlm 代理失败: ", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user