管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-09-28 b1e59a93f4af829250d32f41f5474e041cda517f
1
已修改2个文件
43 ■■■■■ 文件已修改
src/main/java/com/lf/server/aspect/LogAspect.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/HttpHelper.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/aspect/LogAspect.java
@@ -26,13 +26,14 @@
    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        long beginTime = System.currentTimeMillis();
        //执行方法
        // 执行方法
        Object result = point.proceed();
        //执行时长(毫秒)
        long time = System.currentTimeMillis() - beginTime;
        //System.out.println("time"+time);
        //保存日志
        // 执行时长(毫秒)
        long time = System.currentTimeMillis() - beginTime;
        // System.out.println("time:"+time)
        // 保存日志
        saveLogAction(point, time);
        return result;
@@ -44,15 +45,15 @@
        /*LogAction logAction = new LogAction();
        com.landtool.lanbase.common.annotation.LogAction log = method.getAnnotation(com.landtool.lanbase.common.annotation.LogAction.class);
        if(log != null){
            //注解上的描述
            // 注解上的描述
            String[] list = log.value().split(",");
            logAction.setLargemodel(list[0]); //大模块
            logAction.setSmallmodel(list[1]);//小模块
            logAction.setRemark(list[2]);    //备注
            logAction.setActiontype(list[3]);//操作类型
//            logAction.setRemark(log.value());
//            logAction.setActiontype(log.value());
              //logAction.setRemark(log.value());
              //logAction.setActiontype(log.value());
        }
        //获取request
@@ -68,7 +69,7 @@
        logAction.setAppid(loginConfig.getAppId());
//        logAction.setLargemodel(loginConfig.getAppFullName());
          //logAction.setLargemodel(loginConfig.getAppFullName());
src/main/java/com/lf/server/helper/HttpHelper.java
@@ -29,6 +29,12 @@
 * @author WWW
 */
public class HttpHelper {
    private final static String HTTP_SLASH2 = "://";
    private final static String HTTP_SLASH = "/";
    private final static Integer THREE = 3;
    protected static final HeaderGroup HOP_HEADERS;
    static {
@@ -69,7 +75,8 @@
            proxyResponse = client.execute(host, proxyRequest);
            int statusCode = proxyResponse.getStatusLine().getStatusCode();
            response.setStatus(statusCode); // response.setStatus(statusCode, proxyResponse.getStatusLine().getReasonPhrase());
            // response.setStatus(statusCode, proxyResponse.getStatusLine().getReasonPhrase())
            response.setStatus(statusCode);
            copyResponseHeaders(proxyResponse, request, response, url);
@@ -118,7 +125,7 @@
    }
    protected void copyRequestHeader(HttpServletRequest request, HttpRequest proxyRequest, HttpHost host, String headerName) {
        if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH)||HOP_HEADERS.containsHeader(headerName)) {
        if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH) || HOP_HEADERS.containsHeader(headerName)) {
            return;
        }
@@ -152,9 +159,9 @@
    protected String getRealCookie(String cookieValue) {
        StringBuilder escapedCookie = new StringBuilder();
        String cookies[] = cookieValue.split("[;,]");
        String[] cookies = cookieValue.split("[;,]");
        for (String cookie : cookies) {
            String cookieSplit[] = cookie.split("=");
            String[] cookieSplit = cookie.split("=");
            if (cookieSplit.length == 2) {
                String cookieName = cookieSplit[0].trim();
                if (cookieName.startsWith(cookieName)) {
@@ -192,10 +199,7 @@
                .setSocketTimeout(-1)
                .build();
        //return HttpClientBuilder.create()
        //                .setDefaultRequestConfig(requestConfig)
        //                .build();
        // return HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build()
        return HttpClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .build();
@@ -246,8 +250,8 @@
            StringBuffer curUrl = request.getRequestURL();
            int pos;
            if ((pos = curUrl.indexOf("://")) >= 0) {
                if ((pos = curUrl.indexOf("/", pos + 3)) >= 0) {
            if ((pos = curUrl.indexOf(HTTP_SLASH2)) >= 0) {
                if ((pos = curUrl.indexOf(HTTP_SLASH, pos + THREE)) >= 0) {
                    curUrl.setLength(pos);
                }
            }