本文整理了Java中net.oauth.OAuth.decodeForm()
方法的一些代码示例,展示了OAuth.decodeForm()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OAuth.decodeForm()
方法的具体详情如下:
包路径:net.oauth.OAuth
类名称:OAuth
方法名:decodeForm
[英]Parse a form-urlencoded document.
[中]解析表单编码的文档。
代码示例来源:origin: org.apache.shindig/shindig-gadgets
public List<OAuth.Parameter> getParsedQuery() {
if (decodedQuery == null) {
if (query != null) {
decodedQuery = OAuth.decodeForm(query);
} else {
decodedQuery = Lists.newArrayList();
}
}
return decodedQuery;
}
代码示例来源:origin: sakaiproject/sakai
@Override
protected void completeParameters() throws IOException
{
super.completeParameters();
String body = readBodyAsString();
if (body != null) {
addParameters(OAuth.decodeForm(body.trim()));
}
}
代码示例来源:origin: apache/cxf
public static List<OAuth.Parameter> getResponseParams(OAuthMessage message) throws IOException {
String body = OAuthTestUtils.readBody(message);
return OAuth.decodeForm(body);
}
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testGetWithRawBody() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGetWithBody(FakeOAuthServiceProvider.RESOURCE_URL,
"application/json", "war=peace&yes=no".getBytes());
assertEquals("war=peace&yes=no", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
checkContains(queryParams, "oauth_body_hash", "MfhwxPN6ns5CwQAZN9OcJXu3Jv4=");
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testGetWithRawBody() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGetWithBody(FakeOAuthServiceProvider.RESOURCE_URL,
"application/json", "war=peace&yes=no".getBytes());
assertEquals("war=peace&yes=no", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
checkContains(queryParams, "oauth_body_hash", "MfhwxPN6ns5CwQAZN9OcJXu3Jv4=");
}
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Test
public void testGetWithRawBody() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGetWithBody(FakeOAuthServiceProvider.RESOURCE_URL,
"application/json", "war=peace&yes=no".getBytes());
assertEquals("war=peace&yes=no", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
checkContains(queryParams, "oauth_body_hash", "MfhwxPN6ns5CwQAZN9OcJXu3Jv4=");
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testGetWithQuery() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL + "?a=b");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "a", "b"));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testValidParameterCharacters() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
String weird = "~!@$*()-_[]:,./";
HttpResponse resp = client.sendGet(
FakeOAuthServiceProvider.RESOURCE_URL + '?' + weird + "=foo");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, weird, "foo"));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testPostWithQueryNoData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL + "?name=value", null);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "name", "value"));
assertEquals("", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testPostNoQueryWithData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL, "name=value");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertFalse(contains(queryParams, "name", "value"));
assertEquals("name=value", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Test
public void testPostNoQueryWithData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL, "name=value");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertFalse(contains(queryParams, "name", "value"));
assertEquals("name=value", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Test
public void testPostWithQueryWithData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL + "?queryName=queryValue", "name=value");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "queryName", "queryValue"));
assertEquals("name=value", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testGetNoQuery() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, "opensocial_viewer_id", "v"));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testPostWithQueryNoData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL + "?name=value", null);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "name", "value"));
assertEquals("", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testGetWithQueryMultiParam() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL + "?a=b&a=c");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "a", "b"));
assertTrue(contains(queryParams, "a", "c"));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testPostWithQueryWithData() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendFormPost(
FakeOAuthServiceProvider.RESOURCE_URL + "?queryName=queryValue", "name=value");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "queryName", "queryValue"));
assertEquals("name=value", resp.getHeader(FakeOAuthServiceProvider.BODY_ECHO_HEADER));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testGetNoQuery() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, "opensocial_viewer_id", "v"));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testNoSignViewer() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
client.getBaseArgs().setSignViewer(false);
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertFalse(contains(queryParams, "opensocial_viewer_id", "v"));
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testNoSignOwner() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
client.getBaseArgs().setSignOwner(false);
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertFalse(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, "opensocial_viewer_id", "v"));
}
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Test
public void testSignedFetch_extraQueryParameters() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL + "?foo=bar&foo=baz");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, "opensocial_viewer_id", "v"));
assertTrue(contains(queryParams, "opensocial_app_id", "app"));
assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
assertTrue(contains(queryParams, "xoauth_signature_publickey", "foo"));
assertTrue(contains(queryParams, "xoauth_public_key", "foo"));
}
内容来源于网络,如有侵权,请联系作者删除!