|
|
@@ -1,6 +1,6 @@
|
|
|
package com.kym.common.utils;
|
|
|
|
|
|
-import com.alibaba.druid.util.StringUtils;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -24,19 +24,19 @@ public class IPUtils {
|
|
|
String ip = null;
|
|
|
try {
|
|
|
ip = request.getHeader("x-forwarded-for");
|
|
|
- if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
+ if (StrUtil.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
ip = request.getHeader("Proxy-Client-IP");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
|
+ if (StrUtil.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
+ if (StrUtil.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
ip = request.getHeader("HTTP_CLIENT_IP");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
+ if (StrUtil.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
+ if (StrUtil.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
|
|
ip = request.getRemoteAddr();
|
|
|
}
|
|
|
} catch (Exception e) {
|