public static String getHost ( String resourcePath ) { String hostSpec ; if ( resourcePath . contains ( ":" ) ) { hostSpec = resourcePath . split ( ":" ) [ 0 ] ; } else { hostSpec = resourcePath ; } if ( hostSpec . contains ( "/" ) ) { hostSpec = hostSpec . substring ( 0 , hostSpec . indexOf ( ' ' ) ) ; } return hostSpec ; }
Extract host name from resource path .