public static void setCookie(HttpServletRequest request, HttpServletResponse response,
                                 String name,
                                 String value, int maxAge, boolean all_sub_domain) {
    """
	设置COOKIE
	
	@param name   cookie's name.
	@param value  cooke value.
	@param maxAge age time.
    """
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(maxAge);
        if (all_sub_domain) {
            String serverName = request.getServerName();
            String domain = domainOfServerName(serverName);
            if (domain != null && domain.indexOf('.') != -1) {
                cookie.setDomain('.' + domain);
            }
        }
        cookie.setPath(StringPool.SLASH);
        response.addCookie(cookie);
    }
public static void setCookie(HttpServletRequest request, HttpServletResponse response,
                                 String name,
                                 String value, int maxAge, boolean all_sub_domain) {
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(maxAge);
        if (all_sub_domain) {
            String serverName = request.getServerName();
            String domain = domainOfServerName(serverName);
            if (domain != null && domain.indexOf('.') != -1) {
                cookie.setDomain('.' + domain);
            }
        }
        cookie.setPath(StringPool.SLASH);
        response.addCookie(cookie);
    }
public static void setCookie ( HttpServletRequest request , HttpServletResponse response , String name , String value , int maxAge , boolean all_sub_domain ) { Cookie cookie = new Cookie ( name , value ) ; cookie . setMaxAge ( maxAge ) ; if ( all_sub_domain ) { String serverName = request . getServerName ( ) ; String domain = domainOfServerName ( serverName ) ; if ( domain != null && domain . indexOf ( ' ' ) != - 1 ) { cookie . setDomain ( ' ' + domain ) ; } } cookie . setPath ( StringPool . SLASH ) ; response . addCookie ( cookie ) ; }
设置COOKIE

@param name   cookie's name.
@param value  cooke value.
@param maxAge age time.
设置COOKIE