當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。