13693261870
2024-08-23 9e1c97a6fbb4451f32a85ebbf00f6a64156fccc0
se-common/se-common-core/src/main/java/com/se/common/core/utils/StringUtils.java
@@ -8,6 +8,9 @@
import com.se.common.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
/**
 * 字符串工具类
 * 
@@ -605,4 +608,19 @@
        }
        return sb.toString();
    }
    public static String getValueFromCookie(HttpServletRequest request,String key) {
        Cookie[] cookies = request.getCookies();
        if (cookies == null || cookies.length == 0) {
            return null;
        }
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals(key)){
                return cookie.getValue();
            }
        }
        return null;
    }
}