【发布时间】:2015-06-03 01:08:05
【问题描述】:
我正在尝试获取我在 Heroku 中运行的机器的主机名。我想得到的是这样的:https://gentle-hollows-7643-243.com
我现在使用的是InetAddress 类中的getCannoncialHostName。这给了我这样的价值:
String hostName = java.net.InetAddress.getLocalHost.getCannonicalHostName
//returns the following
//be24dfaf-671d-4c37-8468-e1826ea26507.prvt.dyno.rt.heroku.com
这不是我期望收到的,这是https://gentle-hollows-7643-243.com
我误解了getCannonicalHostName 的意图还是因为 Heroku 架构而无法正常工作?
【问题讨论】: