类 RequestUtil
- java.lang.Object
-
- com.alibaba.nacos.config.server.utils.RequestUtil
-
public class RequestUtil extends java.lang.ObjectRequest util.- 作者:
- Nacos
-
-
字段概要
字段 修饰符和类型 字段 说明 static java.lang.StringCLIENT_APPNAME_HEADERstatic java.lang.StringNACOS_USER_KEYprivate static java.lang.StringX_FORWARDED_FORprivate static java.lang.StringX_FORWARDED_FOR_SPLIT_SYMBOLprivate static java.lang.StringX_REAL_IP
-
构造器概要
构造器 构造器 说明 RequestUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static java.lang.StringgetAppName(javax.servlet.http.HttpServletRequest request)Gets the name of the client application in the header.static java.lang.StringgetRemoteIp(javax.servlet.http.HttpServletRequest request)get real client ipstatic java.lang.StringgetSrcUserName(javax.servlet.http.HttpServletRequest request)Gets the username of the client application in the Attribute.static com.alibaba.nacos.auth.model.UsergetUser(javax.servlet.http.HttpServletRequest request)Gets the user of the client application in the Attribute.
-
-
-
字段详细资料
-
X_REAL_IP
private static final java.lang.String X_REAL_IP
- 另请参阅:
- 常量字段值
-
X_FORWARDED_FOR
private static final java.lang.String X_FORWARDED_FOR
- 另请参阅:
- 常量字段值
-
X_FORWARDED_FOR_SPLIT_SYMBOL
private static final java.lang.String X_FORWARDED_FOR_SPLIT_SYMBOL
- 另请参阅:
- 常量字段值
-
CLIENT_APPNAME_HEADER
public static final java.lang.String CLIENT_APPNAME_HEADER
- 另请参阅:
- 常量字段值
-
NACOS_USER_KEY
public static final java.lang.String NACOS_USER_KEY
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getRemoteIp
public static java.lang.String getRemoteIp(javax.servlet.http.HttpServletRequest request)
get real client ipfirst use X-Forwarded-For header https://zh.wikipedia.org/wiki/X-Forwarded-For next nginx X-Real-IP last
ServletRequest.getRemoteAddr()- 参数:
request-HttpServletRequest- 返回:
- remote ip address.
-
getAppName
public static java.lang.String getAppName(javax.servlet.http.HttpServletRequest request)
Gets the name of the client application in the header.- 参数:
request-HttpServletRequest- 返回:
- may be return null
-
getUser
public static com.alibaba.nacos.auth.model.User getUser(javax.servlet.http.HttpServletRequest request)
Gets the user of the client application in the Attribute.- 参数:
request-HttpServletRequest- 返回:
- may be return null
-
getSrcUserName
public static java.lang.String getSrcUserName(javax.servlet.http.HttpServletRequest request)
Gets the username of the client application in the Attribute.- 参数:
request-HttpServletRequest- 返回:
- may be return null
-
-