Codota Logo
InternetDomainName.isTopPrivateDomain
Code IndexAdd Codota to your IDE (free)

How to use
isTopPrivateDomain
method
in
com.google.common.net.InternetDomainName

Best Java code snippets using com.google.common.net.InternetDomainName.isTopPrivateDomain (Showing top 20 results out of 315)

  • Common ways to obtain InternetDomainName
private void myMethod () {
InternetDomainName i =
  • Codota IconString domain;InternetDomainName.from(domain)
  • Codota IconPreconditions preconditions;Object reference;new InternetDomainName(preconditions.checkNotNull(reference))
  • Smart code suggestions by Codota
}
origin: google/guava

/**
 * Returns the portion of this domain name that is one level beneath the {@linkplain
 * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code
 * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code
 * blogspot.com} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned.
 *
 * <p>This method can be used to determine the probable highest level parent domain for which
 * cookies may be set, though even that depends on individual browsers' implementations of cookie
 * controls.
 *
 * @throws IllegalStateException if this domain does not end with a public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: yasserg/crawler4j

  public boolean isRegisteredDomain(String domain) {
    if (onlineUpdate) {
      return publicSuffixList.isRegistrable(domain);
    } else {
      return InternetDomainName.from(domain).isTopPrivateDomain();
    }
  }
}
origin: google/j2objc

/**
 * Returns the portion of this domain name that is one level beneath the {@linkplain
 * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code
 * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code
 * blogspot.com} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned.
 *
 * <p>This method can be used to determine the probable highest level parent domain for which
 * cookies may be set, though even that depends on individual browsers' implementations of cookie
 * controls.
 *
 * @throws IllegalStateException if this domain does not end with a public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: wildfly/wildfly

/**
 * Returns the portion of this domain name that is one level beneath the {@linkplain
 * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code
 * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code
 * blogspot.com} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned.
 *
 * <p>This method can be used to determine the probable highest level parent domain for which
 * cookies may be set, though even that depends on individual browsers' implementations of cookie
 * controls.
 *
 * @throws IllegalStateException if this domain does not end with a public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: google/guava

public void testUnderPrivateDomain() {
 for (String name : UNDER_PRIVATE_DOMAIN) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
 }
}
origin: google/guava

public void testTopPrivateDomain() {
 for (String name : TOP_PRIVATE_DOMAIN) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
  assertTrue(name, domain.isTopPrivateDomain());
  assertEquals(domain.parent(), domain.publicSuffix());
 }
}
origin: google/guava

public void testPublicSuffix() {
 for (String name : PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertTrue(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertFalse(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
  assertEquals(domain, domain.publicSuffix());
 }
 for (String name : NO_PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertFalse(name, domain.hasPublicSuffix());
  assertFalse(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
  assertNull(domain.publicSuffix());
 }
 for (String name : NON_PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
 }
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Returns the portion of this domain name that is one level beneath the {@linkplain
 * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code
 * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code
 * blogspot.com} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned.
 *
 * <p>This method can be used to determine the probable highest level parent domain for which
 * cookies may be set, though even that depends on individual browsers' implementations of cookie
 * controls.
 *
 * @throws IllegalStateException if this domain does not end with a public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/**
 * Returns the portion of this domain name that is one level beneath the {@linkplain
 * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code
 * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code
 * blogspot.com} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned.
 *
 * <p>This method can be used to determine the probable highest level parent domain for which
 * cookies may be set, though even that depends on individual browsers' implementations of cookie
 * controls.
 *
 * @throws IllegalStateException if this domain does not end with a public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: Nextdoor/bender

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: com.google.guava/guava-jdk5

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: com.diffplug.guava/guava-parse

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
  if (isTopPrivateDomain()) {
    return this;
  }
  checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
  return ancestor(publicSuffixIndex - 1);
}
origin: com.atlassian.bundles/guava

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: org.hudsonci.lib.guava/guava

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Returns the portion of this domain name that is one level beneath the
 * public suffix. For example, for {@code x.adwords.google.co.uk} it returns
 * {@code google.co.uk}, since {@code co.uk} is a public suffix.
 *
 * <p>If {@link #isTopPrivateDomain()} is true, the current domain name
 * instance is returned.
 *
 * <p>This method should not be used to determine the topmost parent domain
 * which is addressable as a host, as many public suffixes are also
 * addressable hosts. For example, the domain {@code foo.bar.uk.com} has
 * a public suffix of {@code uk.com}, so it would return {@code bar.uk.com}
 * from this method. But {@code uk.com} is itself an addressable host.
 *
 * <p>This method can be used to determine the probable highest level parent
 * domain for which cookies may be set, though even that depends on individual
 * browsers' implementations of cookie controls.
 *
 * @throws IllegalStateException if this domain does not end with a
 *     public suffix
 * @since 6.0
 */
public InternetDomainName topPrivateDomain() {
 if (isTopPrivateDomain()) {
  return this;
 }
 checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name);
 return ancestor(publicSuffixIndex - 1);
}
origin: googlesamples/android-AutofillFramework

public static String getCanonicalDomain(String domain) {
  InternetDomainName idn = InternetDomainName.from(domain);
  while (idn != null && !idn.isTopPrivateDomain()) {
    idn = idn.parent();
  }
  return idn == null ? null : idn.toString();
}
origin: com.google.guava/guava-tests

public void testUnderPrivateDomain() {
 for (String name : UNDER_PRIVATE_DOMAIN) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
 }
}
origin: com.google.guava/guava-tests

public void testTopPrivateDomain() {
 for (String name : TOP_PRIVATE_DOMAIN) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
  assertTrue(name, domain.isTopPrivateDomain());
  assertEquals(domain.parent(), domain.publicSuffix());
 }
}
origin: com.google.guava/guava-tests

public void testPublicSuffix() {
 for (String name : PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertTrue(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertFalse(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
  assertEquals(domain, domain.publicSuffix());
 }
 for (String name : NO_PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertFalse(name, domain.hasPublicSuffix());
  assertFalse(name, domain.isUnderPublicSuffix());
  assertFalse(name, domain.isTopPrivateDomain());
  assertNull(domain.publicSuffix());
 }
 for (String name : NON_PS) {
  final InternetDomainName domain = InternetDomainName.from(name);
  assertFalse(name, domain.isPublicSuffix());
  assertTrue(name, domain.hasPublicSuffix());
  assertTrue(name, domain.isUnderPublicSuffix());
 }
}
com.google.common.netInternetDomainNameisTopPrivateDomain

Javadoc

Indicates whether this domain name is composed of exactly one subdomain component followed by a #isPublicSuffix(). For example, returns true for google.com foo.co.uk, and myblog.blogspot.com, but not for www.google.com, co.uk, or blogspot.com.

This method can be used to determine whether a domain is probably the highest level for which cookies may be set, though even that depends on individual browsers' implementations of cookie controls. See RFC 2109 for details.

Popular methods of InternetDomainName

  • from
    Returns an instance of InternetDomainName after lenient validation. Specifically, validation against
  • toString
    Returns the domain name, normalized to all lower case.
  • hasPublicSuffix
    Indicates whether this domain name ends in a #isPublicSuffix(), including if it is a public suffix i
  • isValid
    Indicates whether the argument is a syntactically valid domain name using lenient validation. Specif
  • isUnderPublicSuffix
    Indicates whether this domain name ends in a #isPublicSuffix(), while not being a public suffix itse
  • hasParent
    Indicates whether this domain is composed of two or more parts.
  • <init>
    Private constructor used to implement #ancestor(int). Argument parts are assumed to be valid, as the
  • ancestor
    Returns the ancestor of the current domain at the given number of levels "higher" (rightward) in the
  • validatePart
    Helper method for #validateSyntax(List). Validates that one part of a domain name is valid.
  • validateSyntax
    Validation method used by to ensure that the domain name is syntactically valid according to RFC 103
  • topPrivateDomain
    Returns the portion of this domain name that is one level beneath the public suffix. For example, fo
  • name
    Returns the domain name, normalized to all lower case.
  • topPrivateDomain,
  • name,
  • findPublicSuffix,
  • matchesWildcardPublicSuffix,
  • parts,
  • child,
  • hasRegistrySuffix,
  • isTopDomainUnderRegistrySuffix,
  • isUnderRegistrySuffix

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now