private static URI normalizePortNumbersInUri ( final URI uri ) throws URISyntaxException { int port = uri . getPort ( ) ; final String scheme = uri . getScheme ( ) ; if ( SCHEME_HTTP . equals ( scheme ) && port == DEFAULT_HTTP_PORT ) { port = - 1 ; } if ( SCHEME_HTTPS . equals ( scheme ) && port == DEFAULT_HTTPS_PORT ) { port = - 1 ; } final URI result = new URI ( scheme , uri . getUserInfo ( ) , uri . getHost ( ) , port , uri . getPath ( ) , uri . getQuery ( ) , uri . getFragment ( ) ) ; return result ; }
Normalizes a URI . If it contains the default port for the used scheme the method replaces the port with default .