public class UrlUtils extends Object
构造器和说明 |
---|
UrlUtils() |
限定符和类型 | 方法和说明 |
---|---|
static String |
getDomain(String urlInfo,
int level)
提取指定层级的域名
|
static String |
getParameter(String url,
String parameter,
String defaultValue)
获取链接中指定的参数,如果参数为空,则取默认值
|
static String |
getProtocol(String urlInfo)
获取网页地址对应的协议
|
static String |
getServicePoint(String urlInfo)
获取URL服务点地址,包含主机和对应服务端口
|
static boolean |
isFileLink(String urlInfo)
判断一个链接地址是否标识网络文件
|
public static String getServicePoint(String urlInfo) throws MalformedURLException
urlInfo
- MalformedURLException
public static String getProtocol(String urlInfo) throws MalformedURLException
urlInfo
- MalformedURLException
public static String getDomain(String urlInfo, int level) throws MalformedURLException
urlInfo
- level
- 0表示完整域名,1表示1级域名,2表示2级域名,依次类推,但是一般不超过5级域名MalformedURLException
public static String getParameter(String url, String parameter, String defaultValue)
url
- parameter
- defaultValue
-