瀏覽代碼

对科普睿平台所有服务均配置

andyliu 7 月之前
父節點
當前提交
91dc11f569

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/AIModelASProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class AIModelASProxyServlet extends CommonProxyServlet {
+    public AIModelASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/AnalyASProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class AnalyASProxyServlet extends CommonProxyServlet {
+    public AnalyASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 15 - 0
src/main/java/com/shkpr/service/proxycenter/components/CommonProxyServlet.java

@@ -73,12 +73,27 @@ public class CommonProxyServlet extends ProxyServlet {
 
         final String destUri = servletRequest.getRequestURI();
         servletRequest.setAttribute(ATTR_TARGET_URI, null);
+
         if (destUri.startsWith(ApiURI.URI_BASE_PROXY_H)){
             //若不重置super.targetUri;则super.targetUri实际地址为【/data-gw/3th/dma-proxy/*】中*号匹配的部分
             //若重置super.targetUri=XXX; 则super.targetUri实际地址为XXX +【/data-gw/3th/dma-proxy/*】中*号匹配的部分
             super.targetUri = ApiURI.URI_BASE_PROXY_H;
         }else if (destUri.startsWith(ApiURI.URI_TASK_PROXY_H)){
             super.targetUri = ApiURI.URI_TASK_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_ANALY_PROXY_H)){
+            //nothing
+        }else if (destUri.startsWith(ApiURI.URI_PUSH_PROXY_H)){
+            super.targetUri = ApiURI.URI_PUSH_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_IOT_STATS_PROXY_H)){
+            super.targetUri = ApiURI.URI_IOT_STATS_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_IOT_STATS_OLD_PROXY_H)){
+            super.targetUri = ApiURI.URI_IOT_STATS_OLD_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_GIS_AE_PROXY_H)){
+            super.targetUri = ApiURI.URI_GIS_AE_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_DATE_GW_PROXY_H)){
+            super.targetUri = ApiURI.URI_DATE_GW_PROXY_H;
+        }else if (destUri.startsWith(ApiURI.URI_AI_MODEL_PROXY_H)){
+            super.targetUri = ApiURI.URI_AI_MODEL_PROXY_H;
         }
 
         URI uri = null;

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/DataGWASProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class DataGWASProxyServlet extends CommonProxyServlet {
+    public DataGWASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/GisAEASProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class GisAEASProxyServlet extends CommonProxyServlet {
+    public GisAEASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 18 - 0
src/main/java/com/shkpr/service/proxycenter/components/IotStatsASProxyServlet.java

@@ -0,0 +1,18 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class IotStatsASProxyServlet extends CommonProxyServlet {
+    public IotStatsASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}
+

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/IotStatsOldProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class IotStatsOldProxyServlet extends CommonProxyServlet {
+    public IotStatsOldProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 17 - 0
src/main/java/com/shkpr/service/proxycenter/components/PushASProxyServlet.java

@@ -0,0 +1,17 @@
+package com.shkpr.service.proxycenter.components;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class PushASProxyServlet extends CommonProxyServlet {
+    public PushASProxyServlet(String apiProxy) {
+        super(apiProxy);
+    }
+
+    @Override
+    protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
+        super.service(servletRequest, servletResponse);
+    }
+}

+ 92 - 2
src/main/java/com/shkpr/service/proxycenter/configuration/WebSecurityConfiguration.java

@@ -1,7 +1,6 @@
 package com.shkpr.service.proxycenter.configuration;
 
-import com.shkpr.service.proxycenter.components.BaseASProxyServlet;
-import com.shkpr.service.proxycenter.components.TaskASProxyServlet;
+import com.shkpr.service.proxycenter.components.*;
 import com.shkpr.service.proxycenter.constants.ApiURI;
 import com.shkpr.service.proxycenter.controllerfilter.CustomAuthenticationProvider;
 import com.shkpr.service.proxycenter.controllerfilter.SelfBizFilterMgr;
@@ -42,6 +41,27 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
     @Value("${cloud.proxy.address.task:}")
     private String mStrTaskASProxyAddress = "";
 
+    @Value("${cloud.proxy.address.analy:}")
+    private String mStrAnalyASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.gw:}")
+    private String mStrDataGWASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.ai:}")
+    private String mStrAIModelASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.gis:}")
+    private String mStrGisAEASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.old-stats:}")
+    private String mStrOldStatsASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.stats:}")
+    private String mStrStatsASProxyAddress = "";
+
+    @Value("${cloud.proxy.address.push:}")
+    private String mStrPushASProxyAddress = "";
+
     @Override
     protected void configure(AuthenticationManagerBuilder auth) throws Exception {
         //使用自定义身份验证组件
@@ -99,4 +119,74 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
         servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
         return servletRegistrationBean;
     }
+
+    @Bean(name = "ai-model")
+    public ServletRegistrationBean<AIModelASProxyServlet> servletServletRegistrationForAIModel() {
+        ServletRegistrationBean<AIModelASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new AIModelASProxyServlet(mStrAIModelASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_AI_MODEL_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "data-gw")
+    public ServletRegistrationBean<DataGWASProxyServlet> servletServletRegistrationForDataGW() {
+        ServletRegistrationBean<DataGWASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new DataGWASProxyServlet(mStrDataGWASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_DATE_GW_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "gis-ae")
+    public ServletRegistrationBean<GisAEASProxyServlet> servletServletRegistrationForGisAe() {
+        ServletRegistrationBean<GisAEASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new GisAEASProxyServlet(mStrGisAEASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_GIS_AE_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "iot-stats")
+    public ServletRegistrationBean<IotStatsASProxyServlet> servletServletRegistrationForIotStats() {
+        ServletRegistrationBean<IotStatsASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new IotStatsASProxyServlet(mStrStatsASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_IOT_STATS_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "old-iot-stats")
+    public ServletRegistrationBean<IotStatsOldProxyServlet> servletServletRegistrationForOldIotStats() {
+        ServletRegistrationBean<IotStatsOldProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new IotStatsOldProxyServlet(mStrOldStatsASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_IOT_STATS_OLD_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "push")
+    public ServletRegistrationBean<PushASProxyServlet> servletServletRegistrationForPush() {
+        ServletRegistrationBean<PushASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new PushASProxyServlet(mStrPushASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_PUSH_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
+
+    @Bean(name = "analy")
+    public ServletRegistrationBean<AnalyASProxyServlet> servletServletRegistrationForAnaly() {
+        ServletRegistrationBean<AnalyASProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>();
+        servletRegistrationBean.setServlet(new AnalyASProxyServlet(mStrAnalyASProxyAddress));
+        servletRegistrationBean.addUrlMappings(String.format("%s/%s", ApiURI.URI_ANALY_PROXY_H, "*"));
+        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "false");
+        servletRegistrationBean.addInitParameter( "targetUri", "https://127.0.0.1:9000");
+        return servletRegistrationBean;
+    }
 }

+ 21 - 0
src/main/java/com/shkpr/service/proxycenter/constants/ApiURI.java

@@ -85,4 +85,25 @@ public class ApiURI {
 
     public static final String URI_TASK_PROXY_H = "/task";
     public static final String URI_TASK_PROXY_XXX = "/task/**";
+
+    public static final String URI_AI_MODEL_PROXY_H = "/ai-model";
+    public static final String URI_AI_MODEL_PROXY_XXX = "/ai-model/**";
+
+    public static final String URI_ANALY_PROXY_H = "/analy";
+    public static final String URI_ANALY_PROXY_XXX = "/analy/**";
+
+    public static final String URI_DATE_GW_PROXY_H = "/data-gw";
+    public static final String URI_DATE_GW_PROXY_XXX = "/data-gw/**";
+
+    public static final String URI_GIS_AE_PROXY_H = "/gis-ae";
+    public static final String URI_GIS_AE_PROXY_XXX = "/gis-ae/**";
+
+    public static final String URI_IOT_STATS_OLD_PROXY_H = "/stats";
+    public static final String URI_IOT_STATS_OLD_PROXY_XXX = "/stats/**";
+
+    public static final String URI_IOT_STATS_PROXY_H = "/v3/stats";
+    public static final String URI_IOT_STATS_PROXY_XXX = "/v3/stats/**";
+
+    public static final String URI_PUSH_PROXY_H = "/push";
+    public static final String URI_PUSH_PROXY_XXX = "/push/**";
 }

+ 7 - 1
src/main/resources/application.properties

@@ -79,8 +79,14 @@ global.internal.operator.password=$2b$10$Scz7AoeOTUB69piABNLOEepFU7OesRDRStP43g9
 
 
 cloud.proxy.address.base=https://140.246.183.164:9000/
-
 cloud.proxy.address.task=https://140.246.183.164:9000/
+cloud.proxy.address.analy=https://140.246.183.164:9000/
+cloud.proxy.address.gw=https://140.246.183.164:9000/
+cloud.proxy.address.ai-model=https://140.246.183.164:9000/
+cloud.proxy.address.gis=https://140.246.183.164:9000/
+cloud.proxy.address.old-stats=https://140.246.183.164:9000/
+cloud.proxy.address.stats=https://140.246.183.164:9000/
+cloud.proxy.address.push=https://140.246.183.164:9000/