I thought ServletContext might provide a method. Does the getAttribute() method of ServletContext provide any help i.e. is there an attribute name (maybe \"host\", \"port\")
The ServletRequest object that has been passed to your doGet, or doPost method has getServerName
and getServerPort
methods that provide this information.
eg
public void doGet(ServletRequest request, ServletResponse response) {
System.out.println("Host = " + request.getServerName());
System.out.println("Port = " + request.getServerPort());
}