web/src/main/java/org/springframework/security/web/util/UrlUtils.java
public static String buildFullRequestUrl(String scheme, String serverName,
			int serverPort, String requestURI, String queryString) {

		scheme = scheme.toLowerCase();

		StringBuilder url = new StringBuilder();
		url.append(scheme).append("://").append(serverName);

		// Only add port if not default
		if ("http".equals(scheme)) {
			if (serverPort != 80) {
				url.append(":").append(serverPort);
			}
		}
		else if ("https".equals(scheme)) {
			if (serverPort != 443) {
				url.append(":").append(serverPort);
			}
		}

		// Use the requestURI as it is encoded (RFC 3986) and hence suitable for
		// redirects.
		url.append(requestURI);

		if (queryString != null) {
			url.append("?").append(queryString);
		}

		return url.toString();
	}
public static String buildFullRequestUrl(String scheme, String serverName,
			int serverPort, String requestURI, String queryString) {

		scheme = scheme.toLowerCase();

		StringBuilder url = new StringBuilder();
		url.append(scheme).append("://").append(serverName);

		// Only add port if not default
		if ("http".equals(scheme)) {
			if (serverPort != 80) {
				url.append(":").append(serverPort);
			}
		}
		else if ("https".equals(scheme)) {
			if (serverPort != 443) {
				url.append(":").append(serverPort);
			}
		}

		// Use the requestURI as it is encoded (RFC 3986) and hence suitable for
		// redirects.
		url.append(requestURI);

		if (queryString != null) {
			url.append("?").append(queryString);
		}

		return url.toString();
	}
public static String buildFullRequestUrl ( String scheme , String serverName , int serverPort , String requestURI , String queryString ) { scheme = scheme . toLowerCase ( ) ; StringBuilder url = new StringBuilder ( ) ; url . append ( scheme ) . append ( "://" ) . append ( serverName ) ; // Only add port if not default if ( "http" . equals ( scheme ) ) { if ( serverPort != 80 ) { url . append ( ":" ) . append ( serverPort ) ; } } else if ( "https" . equals ( scheme ) ) { if ( serverPort != 443 ) { url . append ( ":" ) . append ( serverPort ) ; } } // Use the requestURI as it is encoded (RFC 3986) and hence suitable for // redirects. url . append ( requestURI ) ; if ( queryString != null ) { url . append ( "?" ) . append ( queryString ) ; } return url . toString ( ) ; }
Obtains the full URL the client used to make the request.
<p>
Note that the server port will not be shown if it is the default server port for
HTTP or HTTPS (80 and 443 respectively).

@return the full URL, suitable for redirects (not decoded).
Obtains the full URL the client used to make the request . <p > Note that the server port will not be shown if it is the default server port for HTTP or HTTPS ( 80 and 443 respectively ) .