Java Code Examples for com.ruoyi.common.utils.IpUtils#getIpAddr()

The following examples show how to use com.ruoyi.common.utils.IpUtils#getIpAddr() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogUtils.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer]
 *
 * @param request
 * @throws Exception
 */
public static void logAccess(HttpServletRequest request) throws Exception
{
    String username = getUsername();
    String jsessionId = request.getRequestedSessionId();
    String ip = IpUtils.getIpAddr(request);
    String accept = request.getHeader("accept");
    String userAgent = request.getHeader("User-Agent");
    String url = request.getRequestURI();
    String params = getParams(request);

    StringBuilder s = new StringBuilder();
    s.append(getBlock(username));
    s.append(getBlock(jsessionId));
    s.append(getBlock(ip));
    s.append(getBlock(accept));
    s.append(getBlock(userAgent));
    s.append(getBlock(url));
    s.append(getBlock(params));
    s.append(getBlock(request.getHeader("Referer")));
    getAccessLog().info(s.toString());
}
 
Example 2
Source File: LogUtils.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer]
 *
 * @param request
 * @throws Exception
 */
public static void logAccess(HttpServletRequest request) throws Exception
{
    String username = getUsername();
    String jsessionId = request.getRequestedSessionId();
    String ip = IpUtils.getIpAddr(request);
    String accept = request.getHeader("accept");
    String userAgent = request.getHeader("User-Agent");
    String url = request.getRequestURI();
    String params = getParams(request);

    StringBuilder s = new StringBuilder();
    s.append(getBlock(username));
    s.append(getBlock(jsessionId));
    s.append(getBlock(ip));
    s.append(getBlock(accept));
    s.append(getBlock(userAgent));
    s.append(getBlock(url));
    s.append(getBlock(params));
    s.append(getBlock(request.getHeader("Referer")));
    getAccessLog().info(s.toString());
}
 
Example 3
Source File: LogUtils.java    From RuoYi with Apache License 2.0 6 votes vote down vote up
/**
 * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer]
 *
 * @param request
 * @throws Exception
 */
public static void logAccess(HttpServletRequest request) throws Exception {
    String username = getUsername();
    String ip = IpUtils.getIpAddr(request);
    String accept = request.getHeader("accept");
    String userAgent = request.getHeader("User-Agent");
    String url = request.getRequestURI();
    String params = getParams(request);

    String s = getBlock(username) +
            getBlock(request.getRequestedSessionId()) +
            getBlock(ip) +
            getBlock(accept) +
            getBlock(userAgent) +
            getBlock(url) +
            getBlock(params) +
            getBlock(request.getHeader("Referer"));
    getAccessLog().info(s);
}