I have a domain abc.jp
For example:
I want to check if this is valid to that I can add another sublevel domain to this example. How to do it? If possible, upload some java codes as reference please?
Thank you
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Your example ac.jp is a valid domain, but not an IP resolvable domain. So I would suggest a whois server. You would need to keep a number of whois servers if you want to check all domains. If you only do Japan then the below snippet should work™.
Guava's
InternetDomainName
provides a good solution to this problem.If the input domain or the subdomain are invalid you'll get an
IllegalArgumentException
.You can also do checks like
domain.isUnderPublicSuffix()
, depending on how much validation you want.