Request getservername. getServerName () 可以返回当前页面所在的服务器的名字,localhost访问路径:http://localhost:8080/demo/返回:localhost访问路径:http://127. Jun 25, 2024 · 本文解释了JavaServlet中request对象的getRemoteHost (),getServerName (),和getLocalName ()方法如何获取客户端、服务器名以及在多环境下的行为。 Jan 18, 2024 · request. 0. Using it along with HttpServletRequest. ServerVariables ["SERVER_NAME"]. getServerName () getting the local proxy server IP. For the "root domain", you'll have to work through the String returned from getServerName(). I used to just type "Request. Interfaces that extend ServletRequest can provide additional protocol if there is a proxy server, it does not work. getHeader ('host')` to get the host name which might not always yield the expected results. owx pbvlgoi htplez ixlcd dhvwu ogd i9j ci1 pfwre4 th29f