goja-web/src/main/java/goja/mvc/kits/Requests.java
public static String domainOfServerName(String host) {
        if (isIPAddr(host)) {
            return null;
        }
        String[] names = StringUtils.split(host, '.');
        if (names == null) return null;
        int len = names.length;
        if (len == 1) return null;
        if (len == 3) {
            return makeup(names[len - 2], names[len - 1]);
        }
        if (len > 3) {
            String dp = names[len - 2];
            if (dp.equalsIgnoreCase("com")
                    || dp.equalsIgnoreCase("gov")
                    || dp.equalsIgnoreCase("net")
                    || dp.equalsIgnoreCase("edu")
                    || dp.equalsIgnoreCase("org")) {
                return makeup(names[len - 3], names[len - 2], names[len - 1]);
            } else {
                return makeup(names[len - 2], names[len - 1]);
            }
        }
        return host;
    }
public static String domainOfServerName(String host) {
        if (isIPAddr(host)) {
            return null;
        }
        String[] names = StringUtils.split(host, '.');
        if (names == null) return null;
        int len = names.length;
        if (len == 1) return null;
        if (len == 3) {
            return makeup(names[len - 2], names[len - 1]);
        }
        if (len > 3) {
            String dp = names[len - 2];
            if (dp.equalsIgnoreCase("com")
                    || dp.equalsIgnoreCase("gov")
                    || dp.equalsIgnoreCase("net")
                    || dp.equalsIgnoreCase("edu")
                    || dp.equalsIgnoreCase("org")) {
                return makeup(names[len - 3], names[len - 2], names[len - 1]);
            } else {
                return makeup(names[len - 2], names[len - 1]);
            }
        }
        return host;
    }
public static String domainOfServerName ( String host ) { if ( isIPAddr ( host ) ) { return null ; } String [ ] names = StringUtils . split ( host , ' ' ) ; if ( names == null ) return null ; int len = names . length ; if ( len == 1 ) return null ; if ( len == 3 ) { return makeup ( names [ len - 2 ] , names [ len - 1 ] ) ; } if ( len > 3 ) { String dp = names [ len - 2 ] ; if ( dp . equalsIgnoreCase ( "com" ) || dp . equalsIgnoreCase ( "gov" ) || dp . equalsIgnoreCase ( "net" ) || dp . equalsIgnoreCase ( "edu" ) || dp . equalsIgnoreCase ( "org" ) ) { return makeup ( names [ len - 3 ] , names [ len - 2 ] , names [ len - 1 ] ) ; } else { return makeup ( names [ len - 2 ] , names [ len - 1 ] ) ; } } return host ; }
获取用户访问URL中的根域名 例如: www.dlog.cn -> dlog.cn

@param host 访问地址
@return 根域名
获取用户访问URL中的根域名 例如 : www . dlog . cn - > dlog . cn