import java.net.MalformedURLException;
import java.net.URL;
import org.apache.http.Header;
class Utilities {
/**
* Return the base URL from the given URL. Example: http://foo.org/abc.html -> http://foo.org/
*
* @param surl
* @return The base URL.
*/
public static String getBaseUrl(String surl) {
URL url;
try {
url = new URL(surl);
System.out.println("getHost: " + url.getHost());
return "http://" + url.getHost() + "/";
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
}