Here you can find the source of extractHostname(String uri)
public static String extractHostname(String uri)
//package com.java2s; //License from project: Apache License import java.net.URI; import java.net.URISyntaxException; public class Main { public static String extractHostname(String uri) { try {//from ww w . j ava 2s .c o m return extractHostname(new URI(uri)); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } @Deprecated public static String extractHostname(URI uri) { return uri.getHost(); } }