java的域名解释实用程序 [英] Domain name interpretation utility for java

查看:177
本文介绍了java的域名解释实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自己需要一个java实用程序来获取一个完全合格的主机名,并且生成域名

I find myself with a need for a java utility for taking a fully-qualified hostname, and producing the domain name from that.

在简单的情况下,这意味着将 host.company.com 转换为公司。 com ,但是,例如 host.subdomain.company.com 或 host.company .co.uk ,其中域名的含义有点模糊。使用 SLD ccSLD ,它会变得凌乱。

In the simple case, that means turning host.company.com into company.com, but this gets rapidly more complicated with host.subdomain.company.com, for example, or host.company.co.uk, where the meaning of "domain name" gets a bit fuzzy. Throw in complications with the definition of SLD and ccSLD, and it gets messy.

所以我的问题是,是否有

So my question is whether there's a 3rd-party library out there that understands these things and can give me sensible interpreations.

推荐答案

Mozilla定期维护它使用的规则在其浏览器中的cookie安全性,可以被其他人解析和使用的格式:

Mozilla regularly maintains the rules that it uses in its browser for cookie security in a format that can be parsed and used by others:

http://publicsuffix.org/

搜索Google时,大概有Java库可以解析列表,但是我不知道他们的质量。

Searching Google, there are probably Java libraries that can parse the list, but I don't know the quality of any of them.

这篇关于java的域名解释实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆