月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-07-23 258825f9bae5492e8d0726d33b75e00417090f72
src/main/java/com/moon/server/helper/HttpHelper.java
@@ -20,7 +20,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpCookie;
import java.net.URI;
import java.net.URISyntaxException;
@@ -294,7 +293,7 @@
    }
    private String filterStr(HttpServletRequest request, HttpServletResponse response, ResEntity res, String str) {
        String url = res.getUrl();
        /*String url = res.getUrl();
        if (url.contains(StaticData.AK)) {
            String[] strs = url.split("\\?");
            url = strs[0];
@@ -308,11 +307,25 @@
            proxyUrl = request.getRequestURL().substring(0, request.getRequestURL().indexOf(proxyUrl) + proxyUrl.length());
            str = str.replace(url, proxyUrl);
            if (str.contains(StaticData.REST_LAYER)) {
            if (StaticData.THREE == res.getFirm() && str.contains(StaticData.REST_LAYER)) {
                str = str.replace(url.replace("/wmts/layer/", StaticData.REST_LAYER), proxyUrl);
            }
        }
        return str;*/
        String[] strs = res.getUrl().contains(StaticData.AK) ? res.getUrl().split("\\?") : new String[]{res.getUrl(), null};
        if (str.contains(strs[0])) {
            String proxyUrl = res.getProxy().replace("{token}", response.getHeader("token"));
            proxyUrl = request.getRequestURL().substring(0, request.getRequestURL().indexOf(proxyUrl) + proxyUrl.length());
            str = str.replace(strs[0], proxyUrl);
            if (StaticData.THREE == res.getFirm() && str.contains(StaticData.REST_LAYER)) {
            }
        }
        return str;
    }
}