Tabnine Logo
InternetDomainName.isTopPrivateDomain
Code IndexAdd Tabnine 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)

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

  • Finding current android device location
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JLabel (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now