当前位置: 首页>>代码示例>>Java>>正文


Java URLUtil类代码示例

本文整理汇总了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;
}
 
开发者ID:venusdrogon,项目名称:feilong-taglib,代码行数:30,代码来源:BreadCrumbUtil.java

示例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));

}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:19,代码来源:ToStringsTest.java

示例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));
}
 
开发者ID:venusdrogon,项目名称:feilong-io,代码行数:13,代码来源:FileUtilTest.java

示例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());
}
 
开发者ID:venusdrogon,项目名称:feilong-io,代码行数:11,代码来源:FileUtilTest.java

示例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"));
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:11,代码来源:GetUnionUrlTest.java

示例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();
}
 
开发者ID:venusdrogon,项目名称:feilong-io,代码行数:11,代码来源:FileUtilTest.java

示例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"));
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:8,代码来源:GetUnionUrlTest.java

示例8: testGetUnionUrlTestNull

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void testGetUnionUrlTestNull(){
    URLUtil.getUnionUrl(url, null);
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:5,代码来源:GetUnionUrlTest.java

示例9: testGetUnionUrlTestEmpty

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetUnionUrlTestEmpty(){
    URLUtil.getUnionUrl(url, "");
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:5,代码来源:GetUnionUrlTest.java

示例10: testGetUnionUrlTestBlank

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetUnionUrlTestBlank(){
    URLUtil.getUnionUrl(url, " ");
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:5,代码来源:GetUnionUrlTest.java

示例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));
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:9,代码来源:ToURLTest.java

示例12: testToURLNull

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
 * Test to URL null.
 */
@Test(expected = NullPointerException.class)
public void testToURLNull(){
    URLUtil.toURL(null);
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:8,代码来源:ToURLTest.java

示例13: testToURLEmpty

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
 * Test to URL empty.
 */
@Test(expected = IllegalArgumentException.class)
public void testToURLEmpty(){
    URLUtil.toURL("");
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:8,代码来源:ToURLTest.java

示例14: testToURLEmpty1

import com.feilong.core.net.URLUtil; //导入依赖的package包/类
/**
 * Test to URL empty 1.
 */
@Test(expected = IllegalArgumentException.class)
public void testToURLEmpty1(){
    URLUtil.toURL(" ");
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:8,代码来源:ToURLTest.java

示例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));
}
 
开发者ID:venusdrogon,项目名称:feilong-core,代码行数:9,代码来源:ToURITest.java


注:本文中的com.feilong.core.net.URLUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。