本文整理汇总了Java中net.oauth.OAuth.decodeForm方法的典型用法代码示例。如果您正苦于以下问题:Java OAuth.decodeForm方法的具体用法?Java OAuth.decodeForm怎么用?Java OAuth.decodeForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.oauth.OAuth
的用法示例。
在下文中一共展示了OAuth.decodeForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNormalizeParameters
import net.oauth.OAuth; //导入方法依赖的package包/类
public void testNormalizeParameters() throws Exception {
for (int c = 0; c < NORMALS.length;) {
String[] normal = NORMALS[c++];
int n = 0;
String label = normal[n++];
List<OAuth.Parameter> parameters = OAuth.decodeForm(normal[n++]);
String expected = normal[n++];
String actual = OAuthSignatureMethod
.normalizeParameters(parameters);
assertEquals(label, expected, actual);
}
}
示例2: getParsedQuery
import net.oauth.OAuth; //导入方法依赖的package包/类
public List<OAuth.Parameter> getParsedQuery() {
if (decodedQuery == null) {
if (query != null) {
decodedQuery = OAuth.decodeForm(query);
} else {
decodedQuery = Lists.newArrayList();
}
}
return decodedQuery;
}
示例3: testSignedFetchParametersSet
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testSignedFetchParametersSet() 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"));
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"));
assertFalse(contains(queryParams, "opensocial_proxied_content", "1"));
}
示例4: testSignedFetchParametersSetProxiedContent
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testSignedFetchParametersSetProxiedContent() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
client.getBaseArgs().setProxiedContentRequest(true);
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"));
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"));
assertTrue(contains(queryParams, "opensocial_proxied_content", "1"));
}
示例5: testPostBinaryData
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testPostBinaryData() throws Exception {
byte[] raw = { 0, 1, 2, 3, 4, 5 };
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL, null, raw);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
byte[] echoedBytes = Base64.decodeBase64(CharsetUtil.getUtf8Bytes(echoed));
assertTrue(Arrays.equals(raw, echoedBytes));
}
示例6: testPostWeirdContentType
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testPostWeirdContentType() throws Exception {
byte[] raw = { 0, 1, 2, 3, 4, 5 };
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
"funky-content", raw);
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
byte[] echoedBytes = Base64.decodeBase64(CharsetUtil.getUtf8Bytes(echoed));
assertTrue(Arrays.equals(raw, echoedBytes));
}
示例7: testGetWithRawBody
import net.oauth.OAuth; //导入方法依赖的package包/类
@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=");
}
示例8: testSignedFetch_unnamedConsumerKey
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testSignedFetch_unnamedConsumerKey() throws Exception {
BasicOAuthStoreConsumerKeyAndSecret defaultKey = new BasicOAuthStoreConsumerKeyAndSecret(
null, FakeOAuthServiceProvider.PRIVATE_KEY_TEXT, KeyType.RSA_PRIVATE, "foo", null);
base.setDefaultKey(defaultKey);
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"));
assertTrue(contains(queryParams, "opensocial_app_id", "app"));
assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "container.com"));
assertTrue(contains(queryParams, "xoauth_signature_publickey", "foo"));
assertTrue(contains(queryParams, "xoauth_public_key", "foo"));
}
示例9: testSignedFetch_extraQueryParameters
import net.oauth.OAuth; //导入方法依赖的package包/类
@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"));
}
示例10: testPostWithQueryWithData
import net.oauth.OAuth; //导入方法依赖的package包/类
@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));
}
示例11: testNoSignOwner
import net.oauth.OAuth; //导入方法依赖的package包/类
@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"));
}
示例12: testPostNoQueryWithData
import net.oauth.OAuth; //导入方法依赖的package包/类
@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));
}
示例13: testGetWithQuery
import net.oauth.OAuth; //导入方法依赖的package包/类
@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"));
}
示例14: testGetWithQueryMultiParam
import net.oauth.OAuth; //导入方法依赖的package包/类
@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"));
}
示例15: testValidParameterCharacters
import net.oauth.OAuth; //导入方法依赖的package包/类
@Test
public void testValidParameterCharacters() throws Exception {
MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
String weird = "[email protected]$*()-_[]:,./";
HttpResponse resp = client.sendGet(
FakeOAuthServiceProvider.RESOURCE_URL + '?' + weird + "=foo");
List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
assertTrue(contains(queryParams, weird, "foo"));
}