public String buildUrl ( ) { StringBuilder sb = new StringBuilder ( ) ; boolean includePort = true ; if ( null != scheme ) { sb . append ( scheme ) . append ( "://" ) ; includePort = ( port != ( scheme . equals ( "http" ) ? 80 : 443 ) ) ; } if ( null != serverName ) { sb . append ( serverName ) ; if ( includePort && port > 0 ) { sb . append ( ' ' ) . append ( port ) ; } } if ( ! Objects . equals ( contextPath , "/" ) ) { sb . append ( contextPath ) ; } sb . append ( buildRequestUrl ( ) ) ; return sb . toString ( ) ; }
Returns full url