本文整理汇总了Java中com.feilong.core.net.URLUtil类的典型用法代码示例。如果您正苦于以下问题:Java URLUtil类的具体用法?Java URLUtil怎么用?Java URLUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
URLUtil类属于com.feilong.core.net包,在下文中一共展示了URLUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restructureBreadCrumbEntityTreeListPath
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Restructure bread crumb entity tree list path.
*
* @param currentBreadCrumbEntityTreeList
* the current bread crumb entity tree list
* @param urlPrefix
* the url prefix
* @return the list< bread crumb entity< object>>
* @since 1.2.2
*/
private static List<BreadCrumbEntity<Object>> restructureBreadCrumbEntityTreeListPath(
List<BreadCrumbEntity<Object>> currentBreadCrumbEntityTreeList,
String urlPrefix){
if (isNullOrEmpty(urlPrefix)){
return currentBreadCrumbEntityTreeList;
}
for (BreadCrumbEntity<Object> breadCrumbEntity : currentBreadCrumbEntityTreeList){
String path = breadCrumbEntity.getPath();
//验证path是不是绝对路径.
if (URIUtil.create(path).isAbsolute()){//(调用了 {@link java.net.URI#isAbsolute()},原理是 <code>url's scheme !=null</code>).
//nothing to do
}else{
breadCrumbEntity.setPath(URLUtil.getUnionUrl(URLUtil.toURL(urlPrefix), path));
}
}
return currentBreadCrumbEntityTreeList;
}
示例2: testToStringsURLs
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to strings UR ls.
*/
@Test
public void testToStringsURLs(){
URL[] urls = {
URLUtil.toURL("http://www.exiaoshuo.com/jinyiyexing0/"),
URLUtil.toURL("http://www.exiaoshuo.com/jinyiyexing1/"),
URLUtil.toURL("http://www.exiaoshuo.com/jinyiyexing2/"),
null };
assertArrayEquals(toArray(
"http://www.exiaoshuo.com/jinyiyexing0/",
"http://www.exiaoshuo.com/jinyiyexing1/",
"http://www.exiaoshuo.com/jinyiyexing2/",
null), toStrings(urls));
}
示例3: testGetContentLength
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test get content length.
*
* @throws IOException
*/
@Test
public void testGetContentLength() throws IOException{
URL url = URLUtil.toURL("http://www.jinbaowang.cn/images//20110722/096718c3d1c9b4a1.jpg");
URLConnection urlConnection = url.openConnection();
int contentLength = urlConnection.getContentLength();
LOGGER.debug(FileUtil.formatSize(contentLength));
}
示例4: testGetP1
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test get p1.
*/
@Test
public void testGetP1(){
URL resource = ClassLoaderUtil.getResource("org/apache/commons/collections4/map");
URI uri = URLUtil.toURI(resource);
File esapiDirectory = new File(uri);
LOGGER.debug(esapiDirectory.getAbsolutePath());
}
示例5: testGetUnionUrl2
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test get union url2.
*/
@Test
public void testGetUnionUrl2(){
assertEquals("http://www.exiaoshuo.com/jinyiyexing/1173348/", URLUtil.getUnionUrl(url, "/jinyiyexing/1173348/"));
assertEquals("http://www.exiaoshuo.com/jinyiyexing/jinyiyexing/1173348/", URLUtil.getUnionUrl(url, "jinyiyexing/1173348/"));
assertEquals("http://www.exiaoshuo.com/jinyiyexing/1173348/", URLUtil.getUnionUrl(url, "1173348/"));
assertEquals("http://www.exiaoshuo.com/jinyiyexing/1173348", URLUtil.getUnionUrl(url, "1173348"));
}
示例6: testFileUtilTest
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* TestFileUtilTest.
*
* @throws IOException
*/
@Test
public void testFileUtilTest() throws IOException{
URL url = URLUtil.toURL("http://localhost:8080/TestHttpURLConnectionPro/index.jsp");
url.openConnection();
}
示例7: testGetUnionUrl1
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test get union url 1.
*/
@Test
public void testGetUnionUrl1(){
LOGGER.debug(URLUtil.getUnionUrl(URLUtil.toURL("E:\\test"), "sanguo"));
}
示例8: testGetUnionUrlTestNull
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void testGetUnionUrlTestNull(){
URLUtil.getUnionUrl(url, null);
}
示例9: testGetUnionUrlTestEmpty
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetUnionUrlTestEmpty(){
URLUtil.getUnionUrl(url, "");
}
示例10: testGetUnionUrlTestBlank
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetUnionUrlTestBlank(){
URLUtil.getUnionUrl(url, " ");
}
示例11: testToURL
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to URL.
*/
@Test
public void testToURL(){
String spec = "C:\\Users\\feilong\\feilong\\train\\新员工\\warmReminder\\20160704141057.html";
LOGGER.debug("" + URLUtil.toURL(spec));
}
示例12: testToURLNull
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to URL null.
*/
@Test(expected = NullPointerException.class)
public void testToURLNull(){
URLUtil.toURL(null);
}
示例13: testToURLEmpty
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to URL empty.
*/
@Test(expected = IllegalArgumentException.class)
public void testToURLEmpty(){
URLUtil.toURL("");
}
示例14: testToURLEmpty1
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to URL empty 1.
*/
@Test(expected = IllegalArgumentException.class)
public void testToURLEmpty1(){
URLUtil.toURL(" ");
}
示例15: testToURI
import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
* Test to URI.
*/
@Test
public void testToURI(){
URL url = URLUtil.toURL("http://www.exiaoshuo.com/jinyiyexing/");
assertEquals(URIUtil.create("http://www.exiaoshuo.com/jinyiyexing/"), URLUtil.toURI(url));
}