org.apache.shindig.common.uri.UriBuilder.setQuery()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.shindig.common.uri.UriBuilder.setQuery()方法的一些代码示例,展示了UriBuilder.setQuery()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UriBuilder.setQuery()方法的具体详情如下:
包路径:org.apache.shindig.common.uri.UriBuilder
类名称:UriBuilder
方法名:setQuery

UriBuilder.setQuery介绍

[英]Assigns the specified query string as the query portion of the uri, automatically decoding parameters to populate the parameter map for calls to getParameter.
[中]将指定的查询字符串指定为uri的查询部分,自动解码参数以填充参数映射以调用getParameter。

代码示例

代码示例来源:origin: com.lmco.shindig/shindig-common

@Test
public void justQuery() {
 UriBuilder builder = new UriBuilder()
   .setQuery("hello=world");
 assertEquals("?hello=world", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void hostRelativePaths() {
 UriBuilder builder = new UriBuilder()
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: com.lmco.shindig/shindig-common

@Test
public void relativePaths() {
 UriBuilder builder = new UriBuilder()
   .setPath("foo")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("foo?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.apache.shindig/shindig-common

@Test
public void hostRelativePaths() {
 UriBuilder builder = new UriBuilder()
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.apache.shindig/shindig-common

@Test
public void relativePaths() {
 UriBuilder builder = new UriBuilder()
   .setPath("foo")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("foo?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void noAuthorityUsed() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("http:/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void noFragmentUsed() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello=world");
 assertEquals("http://apache.org/shindig?hello=world", builder.toString());
}

代码示例来源:origin: org.apache.shindig/shindig-common

@Test
public void noAuthorityUsed() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("http:/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.apache.shindig/shindig-common

@Test
public void queryStringIsUnescaped() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello+world=world%26bar");
 assertEquals("world&bar", builder.getQueryParameter("hello world"));
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void noSchemeUsed() {
 UriBuilder builder = new UriBuilder()
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("//apache.org/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void noFragmentUsed() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello=world");
 assertEquals("http://apache.org/shindig?hello=world", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void queryStringIsUnescaped() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello+world=world%26bar");
 assertEquals("world&bar", builder.getQueryParameter("hello world"));
}

代码示例来源:origin: org.apache.shindig/shindig-common

@Test
public void addSingleFragmentParameter() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void addSingleFragmentParameter() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world", builder.toString());
}

代码示例来源:origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void allPartsUsed() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .setQuery("hello=world")
   .setFragment("foo");
 assertEquals("http://apache.org/shindig?hello=world#foo", builder.toString());
}

代码示例来源:origin: com.lmco.shindig/shindig-common

@Test
public void addSingleFragmentParameter() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world", builder.toString());
}

代码示例来源:origin: org.gatein.shindig/shindig-common

@Test
public void addTwoFragmentParameters() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .addFragmentParameter("foo", "bar")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world&foo=bar", builder.toString());
}

代码示例来源:origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void addIdenticalFragmentParameters() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .addFragmentParameter("hello", "goodbye")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world&hello=goodbye", builder.toString());
}

代码示例来源:origin: com.lmco.shindig/shindig-common

@Test
public void addIdenticalFragmentParameters() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello", "world")
   .addFragmentParameter("hello", "goodbye")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello=world&hello=goodbye", builder.toString());
}

代码示例来源:origin: com.lmco.shindig/shindig-common

@Test
public void fragmentParamsAreEscaped() {
 UriBuilder builder = new UriBuilder()
   .setScheme("http")
   .setAuthority("apache.org")
   .setPath("/shindig")
   .addFragmentParameter("hello world", "foo&bar")
   .setQuery("foo");
 assertEquals("http://apache.org/shindig?foo#hello+world=foo%26bar", builder.toString());
 assertEquals("hello+world=foo%26bar", builder.getFragment());
}

相关文章