oauth.signpost
クラス OAuth

java.lang.Object
  上位を拡張 oauth.signpost.OAuth

public class OAuth
extends Object


フィールドの概要
static String ENCODING
           
static String FORM_ENCODED
           
static String HTTP_AUTHORIZATION_HEADER
           
static String OAUTH_CALLBACK
           
static String OAUTH_CALLBACK_CONFIRMED
           
static String OAUTH_CONSUMER_KEY
           
static String OAUTH_NONCE
           
static String OAUTH_SIGNATURE
           
static String OAUTH_SIGNATURE_METHOD
           
static String OAUTH_TIMESTAMP
           
static String OAUTH_TOKEN
           
static String OAUTH_TOKEN_SECRET
           
static String OAUTH_VERIFIER
           
static String OAUTH_VERSION
           
static String OUT_OF_BAND
          Pass this value as the callback "url" upon retrieving a request token if your application cannot receive callbacks (e.g. because it's a desktop app).
static String VERSION_1_0
           
 
コンストラクタの概要
OAuth()
           
 
メソッドの概要
static String addQueryParameters(String url, Map<String,String> params)
           
static String addQueryParameters(String url, String... kvPairs)
          Appends a list of key/value pairs to the given URL, e.g.: String url = OAuth.addQueryParameters("http://example.com?
static String addQueryString(String url, String queryString)
           
static void debugOut(String key, String value)
           
static HttpParameters decodeForm(InputStream content)
           
static HttpParameters decodeForm(String form)
          Parse a form-urlencoded document.
static
<T extends Map.Entry<String,String>>
String
formEncode(Collection<T> parameters)
          Construct a x-www-form-urlencoded document containing the given sequence of name/value pairs.
static
<T extends Map.Entry<String,String>>
void
formEncode(Collection<T> parameters, OutputStream into)
          Construct a x-www-form-urlencoded document containing the given sequence of name/value pairs.
static boolean isEmpty(String str)
           
static HttpParameters oauthHeaderToParamsMap(String oauthHeader)
           
static String percentDecode(String s)
           
static String percentEncode(String s)
           
static String prepareOAuthHeader(String... kvPairs)
          Builds an OAuth header from the given list of header fields.
static String safeToString(Object from)
           
static String toHeaderElement(String name, String value)
          Helper method to concatenate a parameter and its value to a pair that can be used in an HTTP header.
static
<T extends Map.Entry<String,String>>
Map<String,String>
toMap(Collection<T> from)
          Construct a Map containing a copy of the given parameters.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

VERSION_1_0

public static final String VERSION_1_0
関連項目:
定数フィールド値

ENCODING

public static final String ENCODING
関連項目:
定数フィールド値

FORM_ENCODED

public static final String FORM_ENCODED
関連項目:
定数フィールド値

HTTP_AUTHORIZATION_HEADER

public static final String HTTP_AUTHORIZATION_HEADER
関連項目:
定数フィールド値

OAUTH_CONSUMER_KEY

public static final String OAUTH_CONSUMER_KEY
関連項目:
定数フィールド値

OAUTH_TOKEN

public static final String OAUTH_TOKEN
関連項目:
定数フィールド値

OAUTH_TOKEN_SECRET

public static final String OAUTH_TOKEN_SECRET
関連項目:
定数フィールド値

OAUTH_SIGNATURE_METHOD

public static final String OAUTH_SIGNATURE_METHOD
関連項目:
定数フィールド値

OAUTH_SIGNATURE

public static final String OAUTH_SIGNATURE
関連項目:
定数フィールド値

OAUTH_TIMESTAMP

public static final String OAUTH_TIMESTAMP
関連項目:
定数フィールド値

OAUTH_NONCE

public static final String OAUTH_NONCE
関連項目:
定数フィールド値

OAUTH_VERSION

public static final String OAUTH_VERSION
関連項目:
定数フィールド値

OAUTH_CALLBACK

public static final String OAUTH_CALLBACK
関連項目:
定数フィールド値

OAUTH_CALLBACK_CONFIRMED

public static final String OAUTH_CALLBACK_CONFIRMED
関連項目:
定数フィールド値

OAUTH_VERIFIER

public static final String OAUTH_VERIFIER
関連項目:
定数フィールド値

OUT_OF_BAND

public static final String OUT_OF_BAND
Pass this value as the callback "url" upon retrieving a request token if your application cannot receive callbacks (e.g. because it's a desktop app). This will tell the service provider that verification happens out-of-band, which basically means that it will generate a PIN code (the OAuth verifier) and display that to your user. You must obtain this code from your user and pass it to OAuthProvider#retrieveAccessToken(OAuthConsumer, String) in order to complete the token handshake.

関連項目:
定数フィールド値
コンストラクタの詳細

OAuth

public OAuth()
メソッドの詳細

percentEncode

public static String percentEncode(String s)

percentDecode

public static String percentDecode(String s)

formEncode

public static <T extends Map.Entry<String,String>> void formEncode(Collection<T> parameters,
                                                                   OutputStream into)
                       throws IOException
Construct a x-www-form-urlencoded document containing the given sequence of name/value pairs. Use OAuth percent encoding (not exactly the encoding mandated by x-www-form-urlencoded).

例外:
IOException

formEncode

public static <T extends Map.Entry<String,String>> String formEncode(Collection<T> parameters)
                         throws IOException
Construct a x-www-form-urlencoded document containing the given sequence of name/value pairs. Use OAuth percent encoding (not exactly the encoding mandated by x-www-form-urlencoded).

例外:
IOException

decodeForm

public static HttpParameters decodeForm(String form)
Parse a form-urlencoded document.


decodeForm

public static HttpParameters decodeForm(InputStream content)
                                 throws IOException
例外:
IOException

toMap

public static <T extends Map.Entry<String,String>> Map<String,String> toMap(Collection<T> from)
Construct a Map containing a copy of the given parameters. If several parameters have the same name, the Map will contain the first value, only.


safeToString

public static final String safeToString(Object from)

isEmpty

public static boolean isEmpty(String str)

addQueryParameters

public static String addQueryParameters(String url,
                                        String... kvPairs)
Appends a list of key/value pairs to the given URL, e.g.:
 String url = OAuth.addQueryParameters("http://example.com?a=1", b, 2, c, 3);
 
which yields:
 http://example.com?a=1&b=2&c=3
 
All parameters will be encoded according to OAuth's percent encoding rules.

パラメータ:
url - the URL
kvPairs - the list of key/value pairs
戻り値:

addQueryParameters

public static String addQueryParameters(String url,
                                        Map<String,String> params)

addQueryString

public static String addQueryString(String url,
                                    String queryString)

prepareOAuthHeader

public static String prepareOAuthHeader(String... kvPairs)
Builds an OAuth header from the given list of header fields. All parameters starting in 'oauth_*' will be percent encoded.
 String authHeader = OAuth.prepareOAuthHeader("realm", "http://example.com", "oauth_token", "x%y");
 
which yields:
 OAuth realm="http://example.com", oauth_token="x%25y"
 

パラメータ:
kvPairs - the list of key/value pairs
戻り値:
a string eligible to be used as an OAuth HTTP Authorization header.

oauthHeaderToParamsMap

public static HttpParameters oauthHeaderToParamsMap(String oauthHeader)

toHeaderElement

public static String toHeaderElement(String name,
                                     String value)
Helper method to concatenate a parameter and its value to a pair that can be used in an HTTP header. This method percent encodes both parts before joining them.

パラメータ:
name - the OAuth parameter name, e.g. oauth_token
value - the OAuth parameter value, e.g. 'hello oauth'
戻り値:
a name/value pair, e.g. oauth_token="hello%20oauth"

debugOut

public static void debugOut(String key,
                            String value)


Copyright © 2012. All Rights Reserved.