All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.soulgalore.velocity.HostTool Maven / Gradle / Ivy

package com.soulgalore.velocity;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * Class to manipulate hosts.
 *
 */
public class HostTool {
	
	/**
	 * Get the host from an url. If the url is malformed, an empty String is returned.
	 * @param url the url
	 * @return the host
	 */
	public final String getHost(String url) {
		try {
			return (new URL(url)).getHost();
		} catch (MalformedURLException e) {
			return "";
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy