public static boolean domainMatches (String domain, String host)

The utility method to check whether a host name is in a domain or not.

This concept is described in the cookie specification. To understand the concept, some terminologies need to be defined first:

effective host name = hostname if host name contains dot
                 or = hostname.local if not

Host A's name domain-matches host B's if:

A host isn't in a domain (RFC 2965 sec. 3.3.2) if:

Examples:

Parameters:
domain    the domain name to check host name with
host    the host name in question

Returns:  true if they domain-matches; false if not