Tabnine Logo
InternetDomainName.parts
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: apache/incubator-pinot

public synchronized String getShortName() {
 if (_shortName == null) {
  String shortHostName;
  try {
   InternetDomainName domainName = InternetDomainName.from(_hostName);
   shortHostName = domainName.parts().get(0);
  } catch (Exception e) {
   shortHostName = _hostName;
  }
  if (_tableType == TableType.OFFLINE) {
   _shortName = shortHostName + SHORT_OFFLINE_SUFFIX;
  } else {
   _shortName = shortHostName + SHORT_REALTIME_SUFFIX;
  }
 }
 return _shortName;
}
origin: apache/incubator-pinot

/**
 * As per <a href="https://tools.ietf.org/html/rfc952">RFC-952</a> domain names should begin with a letter.
 * That said, <a href="https://tools.ietf.org/html/rfc1123#page-13">RFC-1123</a> updated it say that it may also begin
 * with a digit. Indeed, <a href="http://9292.nl/">this</a> is a valid domain name. Only the top-level domain (i.e. the
 * last portion) has to be non-numeric. More clarification on this matter is in
 * <a href="https://tools.ietf.org/html/rfc3696#section-2">RFC-3696</a>
 *
 * A potentially faster solution is
 *
 * if (first char is a digit) {
 *   it is probably ipv4;
 *   return name;
 * } else {
 *   it could be ipv6 (in which case no dots), or a hostname
 *   return substring before the first dot.
 * }
 *
 * It will fail if there are host names starting with a digit, but will work right otherwise.
 */
private String makeShortHostName(final String name) {
 try {
  InternetDomainName domainName = InternetDomainName.from(name);
  return domainName.parts().get(0);
 } catch (Exception e) {
  return name;
 }
}
origin: apache/metron

String ret = idn.publicSuffix().toString();
if(ret.startsWith("InternetDomainName")) {
 return Joiner.on(".").join(idn.publicSuffix().parts());
origin: stackoverflow.com

 Set<String> nonePublicDomainParts(String uriHost) {
  InternetDomainName fullDomainName = InternetDomainName.from(uriHost);
  InternetDomainName publicDomainName = fullDomainName.publicSuffix();
  Set<String> nonePublicParts = new HashSet<String>(fullDomainName.parts());
  nonePublicParts.removeAll(publicDomainName.parts());
  return nonePublicParts;
}
origin: stackoverflow.com

 public static String getTopLevelDomain(String uri) {

InternetDomainName fullDomainName = InternetDomainName.from(uri);
InternetDomainName publicDomainName = fullDomainName.topPrivateDomain();
String topDomain = "";

Iterator<String> it = publicDomainName.parts().iterator();
while(it.hasNext()){
  String part = it.next();
  if(!topDomain.isEmpty())topDomain += ".";
  topDomain += part;
}
return topDomain;
}
origin: nielsbasjes/yauaa

private String extractCompanyFromHostName(String hostname) {
  try {
    InternetDomainName domainName = InternetDomainName.from(hostname);
    return Normalize.brand(domainName.topPrivateDomain().parts().get(0));
  } catch (RuntimeException e) {
    return null;
  }
}
origin: uk.bl.wa.discovery/warc-indexer

public static String extractPublicSuffixFromHost( String host ) {
  if( host == null ) return null;
  // Parse out the public suffix:
  InternetDomainName domainName;
  try {
    domainName = InternetDomainName.from(host);
  } catch( Exception e ) {
    return null;
  }
  InternetDomainName suffix = null;
  if( host.endsWith(".uk")) {
    ImmutableList<String> parts = domainName.parts();
    if( parts.size() >= 2 ) {
      suffix = InternetDomainName.from(parts.get(parts.size() - 2)
          + "." + parts.get(parts.size() - 1));
    }
  } else {
    suffix = domainName.publicSuffix();
  }
  // Return a value:
  if( suffix == null ) return null;
  return suffix.toString();
}

origin: ukwa/webarchive-discovery

public static String extractPublicSuffixFromHost( String host ) {
  if( host == null ) return null;
  // Parse out the public suffix:
  InternetDomainName domainName;
  try {
    domainName = InternetDomainName.from(host);
  } catch( Exception e ) {
    return null;
  }
  InternetDomainName suffix = null;
  if( host.endsWith(".uk")) {
    ImmutableList<String> parts = domainName.parts();
    if( parts.size() >= 2 ) {
      suffix = InternetDomainName.from(parts.get(parts.size() - 2)
          + "." + parts.get(parts.size() - 1));
    }
  } else {
    suffix = domainName.publicSuffix();
  }
  // Return a value:
  if( suffix == null ) return null;
  return suffix.toString();
}

origin: jclouds/legacy-jclouds

  @Override
  public String apply(Endpoint input) {
   if (input.getRegion() != null)
     return input.getRegion();
   String host = input.getPublicURL().getHost();
   if (InternetDomainName.isValid(host)) {
     InternetDomainName domain = InternetDomainName.from(host);
     return domain.parts().get(0);
   }
   return provider;
  }
}
origin: org.jclouds.common/openstack-common

  @Override
  public String apply(Endpoint input) {
   if (input.getRegion() != null)
     return input.getRegion();
   String host = input.getPublicURL().getHost();
   if (InternetDomainName.isValid(host)) {
     InternetDomainName domain = InternetDomainName.from(host);
     return domain.parts().get(0);
   }
   return provider;
  }
}
origin: io.cloudsoft.jclouds.common/openstack-common

  @Override
  public String apply(Endpoint input) {
   if (input.getRegion() != null)
     return input.getRegion();
   String host = input.getPublicURL().getHost();
   if (InternetDomainName.isValid(host)) {
     InternetDomainName domain = InternetDomainName.from(host);
     return domain.parts().get(0);
   }
   return provider;
  }
}
origin: apache/jclouds

  @Override
  public String apply(Endpoint input) {
   if (input.getRegion() != null)
     return input.getRegion();
   String host = input.getPublicURL().getHost();
   if (InternetDomainName.isValid(host)) {
     InternetDomainName domain = InternetDomainName.from(host);
     return domain.parts().get(0);
   }
   return provider;
  }
}
origin: ukwa/webarchive-discovery

ImmutableList<String> parts = domainName.parts();
if( parts.size() >= 3 ) {
  suffix = InternetDomainName.from(parts.get(parts.size() - 3)
origin: uk.bl.wa.discovery/warc-indexer

ImmutableList<String> parts = domainName.parts();
if( parts.size() >= 3 ) {
  suffix = InternetDomainName.from(parts.get(parts.size() - 3)
origin: addthis/hydra

InternetDomainName domainName = InternetDomainName.from(returnhost);
if (domainName.isTopPrivateDomain() || domainName.isUnderPublicSuffix()) {
  topDomain = DOT_JOINER.join(domainName.topPrivateDomain().parts());
com.google.common.netInternetDomainNameparts

Javadoc

The parts of the domain name, converted to lower case.

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
  • isTopPrivateDomain
    Indicates whether this domain name is composed of exactly one subdomain component followed by a #isP
  • 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
  • validateSyntax,
  • topPrivateDomain,
  • name,
  • findPublicSuffix,
  • matchesWildcardPublicSuffix,
  • 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