getRequestURL() omits the port when it is 80, while the http scheme or when it is 443, while the https scheme.
So just use getRequestURL() if all you need is to get the whole URL. However, this does not include the GET request string. You can build it like this:
StringBuffer requestURL = request.getRequestURL(); if (request.getQueryString() != null) { requestURL.append("?").append(request.getQueryString()); } String completeURL = requestURL.toString();
BalusC Dec 10 '10 at 19:25 2010-12-10 19:25
source share