public String getServerName() { return request.getServerName(); }
private String hostname() { if (InternalUtils.isBlank(hostname)) { return request.getServerName(); } // This is common in some PaaS deployments, such as Heroku, where the port is passed in as // and environment variable. if (this.hostname.startsWith("$")) { return System.getenv(hostname.substring(1)); } return hostname; } }
pw.write("path", request.getPath()); pw.write("locale", request.getLocale()); pw.write("serverName", request.getServerName()); pw.write("remoteHost", request.getRemoteHost());
dt(writer, "Server Name", request.getServerName());
@Test public void server_name_from_request_object() { expect(request.getServerName()).andReturn("localhost").once(); expect(request.getServerPort()).andReturn(80).once(); expect(request.isSecure()).andReturn(false); replay(); BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "", 0, 0); assertEquals(baseURLSource.getBaseURL(false), "http://localhost"); verify(); }