类 RequestUtil


  • public class RequestUtil
    extends java.lang.Object
    Request util.
    作者:
    Nacos
    • 构造器概要

      构造器 
      构造器 说明
      RequestUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.lang.String getAppName​(javax.servlet.http.HttpServletRequest request)
      Gets the name of the client application in the header.
      static java.lang.String getRemoteIp​(javax.servlet.http.HttpServletRequest request)
      get real client ip
      static java.lang.String getSrcUserName​(javax.servlet.http.HttpServletRequest request)
      Gets the username of the client application in the Attribute.
      static com.alibaba.nacos.auth.model.User getUser​(javax.servlet.http.HttpServletRequest request)
      Gets the user of the client application in the Attribute.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • 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
        另请参阅:
        常量字段值
    • 构造器详细资料

      • RequestUtil

        public RequestUtil()
    • 方法详细资料

      • getRemoteIp

        public static java.lang.String getRemoteIp​(javax.servlet.http.HttpServletRequest request)
        get real client ip

        first 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