本文整理了Java中com.ning.http.client.uri.Uri.create()
方法的一些代码示例,展示了Uri.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Uri.create()
方法的具体详情如下:
包路径:com.ning.http.client.uri.Uri
类名称:Uri
方法名:create
暂无
代码示例来源:origin: com.ning/async-http-client
public static Uri create(String originalUrl) {
return create(null, originalUrl);
}
代码示例来源:origin: com.ning/async-http-client
public T setUrl(String url) {
return setUri(Uri.create(url));
}
代码示例来源:origin: com.ning/async-http-client
Uri redirUri = Uri.create(uri, location);
代码示例来源:origin: com.ning/async-http-client
: httpTransactionContext.lastRedirectUri;
final Uri redirectUri = Uri.create(origUri, redirectURL);
httpTransactionContext.lastRedirectUri = redirectUri;
代码示例来源:origin: com.ning/async-http-client
Uri uri = Uri.create(future.getUri(), location);
future.setUri(uri);
String newUrl = uri.toUrl();
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRootRelativeURIWithNonRootContext() {
Uri context = Uri.create("https://graph.facebook.com/foo/bar");
Uri url = Uri.create(context, "/750198471659552/accounts/test-users?method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "graph.facebook.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/750198471659552/accounts/test-users");
assertEquals(url.getQuery(), "method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testNonRootRelativeURIWithNonRootContext() {
Uri context = Uri.create("https://graph.facebook.com/foo/bar");
Uri url = Uri.create(context, "750198471659552/accounts/test-users?method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "graph.facebook.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/foo/750198471659552/accounts/test-users");
assertEquals(url.getQuery(), "method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithConsecutiveDotsFromRoot() {
Uri context = Uri.create("https://hello.com/");
Uri url = Uri.create(context, "../../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../../../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testAbsoluteURIWithContext() {
Uri context = Uri.create("https://hello.com/foo/bar");
Uri url = Uri.create(context, "https://graph.facebook.com/750198471659552/accounts/test-users?method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "graph.facebook.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/750198471659552/accounts/test-users");
assertEquals(url.getQuery(), "method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithDotsAboveRoot() {
Uri context = Uri.create("https://hello.com/level1");
Uri url = Uri.create(context, "../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithConsecutiveDotsFromRootResource() {
Uri context = Uri.create("https://hello.com/level1");
Uri url = Uri.create(context, "../../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../../../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRootRelativeURIWithRootContext() {
Uri context = Uri.create("https://graph.facebook.com");
Uri url = Uri.create(context, "/750198471659552/accounts/test-users?method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "graph.facebook.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/750198471659552/accounts/test-users");
assertEquals(url.getQuery(), "method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithAbsoluteConsecutiveDots() {
Uri context = Uri.create("https://hello.com/level1/level2/");
Uri url = Uri.create(context, "/../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithConsecutiveDotsFromSubrootResource() {
Uri context = Uri.create("https://hello.com/level1/level2");
Uri url = Uri.create(context, "../../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithConsecutiveDotsFromLevel3Resource() {
Uri context = Uri.create("https://hello.com/level1/level2/level3");
Uri url = Uri.create(context, "../../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../other/content/img.png");
assertNull(url.getQuery());
}
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithDots() {
Uri context = Uri.create("https://hello.com/level1/level2/");
Uri url = Uri.create(context, "../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/level1/other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithAbsoluteDots() {
Uri context = Uri.create("https://hello.com/level1/");
Uri url = Uri.create(context, "/../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/../other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testRelativeUriWithConsecutiveDots() {
Uri context = Uri.create("https://hello.com/level1/level2/");
Uri url = Uri.create(context, "../../other/content/img.png");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "hello.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/other/content/img.png");
assertNull(url.getQuery());
}
代码示例来源:origin: javaee/grizzly-ahc
@Test
public void testSimpleParsing() {
Uri url = Uri.create("https://graph.facebook.com/750198471659552/accounts/test-users?method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
assertEquals(url.getScheme(), "https");
assertEquals(url.getHost(), "graph.facebook.com");
assertEquals(url.getPort(), -1);
assertEquals(url.getPath(), "/750198471659552/accounts/test-users");
assertEquals(url.getQuery(), "method=get&access_token=750198471659552lleveCvbUu_zqBa9tkT3tcgaPh4");
}
代码示例来源:origin: javaee/grizzly-ahc
@Test(groups = "fast")
public void testGetCalculateSignature() {
ConsumerKey consumer = new ConsumerKey(CONSUMER_KEY, CONSUMER_SECRET);
RequestToken user = new RequestToken(TOKEN_KEY, TOKEN_SECRET);
OAuthSignatureCalculator calc = new OAuthSignatureCalculator(consumer, user);
List<Param> queryParams = new ArrayList<>();
queryParams.add(new Param("file", "vacation.jpg"));
queryParams.add(new Param("size", "original"));
String url = "http://photos.example.net/photos";
String sig = calc.calculateSignature("GET", Uri.create(url), TIMESTAMP, NONCE, null, queryParams);
assertEquals(sig, "tR3+Ty81lMeYAr/Fid0kMTYa/WM=");
}
内容来源于网络,如有侵权,请联系作者删除!