办法是有啊,很复杂哟,得自己实现Request。
用这个方法先试试吧, 在servlet里
String host = request.getHeader("Host");
int pos = host.indexOf(":");
int port = 0;
if (pos != -1) {
port = host.substring(pos+1);
}
System.out.println(port);
Ik seems as <HttpServletRequest>.getHeader("REMOTE_PORT"); gives me the correct port.
Even if MS hasn't documented it (it still appears in their source code :-) )
BTW : Even Apache gave me the same Environment Variables with the method 'getHeaderNames()'