从request请求中获取:
IP或域名:request.getServerName()
端口:request.getServerPort()
程序路径:request.getContextPath()
设备的IP:request.getRemoteAddr()
从URL中获取:
String urlAddress = "http://localhost:8080/resource/getUpdateInfo.hd";
URL url = new URL(urlAddress);
IP或域名:url.getHost()
端口:url.getPort()
程序路径:url.getPath()