com.dyuproject.oauth
Class Transport

java.lang.Object
  extended by com.dyuproject.oauth.Transport
All Implemented Interfaces:
Signature.Listener
Direct Known Subclasses:
HttpAuthTransport, HttpGetTransport, HttpPostTransport

public abstract class Transport
extends Object
implements Signature.Listener

The scheme/transport which determines how the oauth parameters are sent over http.

Author:
David Yu
Date created:
Jun 1, 2009

Constructor Summary
Transport()
           
 
Method Summary
static void appendToUrl(String key, String value, StringBuilder urlBuffer)
          Appends the key and the value; Encodes the value before it is appended.
static StringBuilder buildAuthUrl(String authUrl, Token token)
          Builds the auth url as StringBuilder to redirect the user to, based from the given token.
static StringBuilder buildAuthUrl(String authUrl, Token token, String callbackUrl)
          Builds the auth url as StringBuilder to redirect the user to, based from the given token and callback url.
static Transport get(String name)
          Gets a transport based from the given name.
static String getAuthUrl(String authUrl, Token token)
          Gets the auth url based from the given token.
static String getAuthUrl(String authUrl, Token token, String callbackUrl)
          Gets the auth url based from the given token and callback url.
abstract  String getMethod()
          Gets the method name of this transport.
abstract  String getName()
          Gets the name of this transport.
 void handleRequestParameter(String key, String value, StringBuilder buffer)
          Handles the encoded request key and value.
 void putDefaults(UrlEncodedParameterMap params, Endpoint ep, Token token, TokenExchange exchange, NonceAndTimestamp nts, Signature signature, StringBuilder oauthBuffer, StringBuilder requestBuffer)
          Put the default oauth parameters on the UrlEncodedParameterMap params.
static void register(Transport transport)
          Registers a custom transport.
abstract  HttpConnector.Response send(UrlEncodedParameterMap params, Endpoint ep, Token token, TokenExchange exchange, NonceAndTimestamp nts, Signature signature, HttpConnector connector)
          Sends the params to the service provided and returns the http response HttpConnector.Response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.dyuproject.oauth.Signature.Listener
handleOAuthParameter
 

Constructor Detail

Transport

public Transport()
Method Detail

register

public static void register(Transport transport)
Registers a custom transport.


get

public static Transport get(String name)
Gets a transport based from the given name.


appendToUrl

public static void appendToUrl(String key,
                               String value,
                               StringBuilder urlBuffer)
Appends the key and the value; Encodes the value before it is appended.


buildAuthUrl

public static StringBuilder buildAuthUrl(String authUrl,
                                         Token token)
Builds the auth url as StringBuilder to redirect the user to, based from the given token.


buildAuthUrl

public static StringBuilder buildAuthUrl(String authUrl,
                                         Token token,
                                         String callbackUrl)
Builds the auth url as StringBuilder to redirect the user to, based from the given token and callback url.


getAuthUrl

public static String getAuthUrl(String authUrl,
                                Token token)
Gets the auth url based from the given token.


getAuthUrl

public static String getAuthUrl(String authUrl,
                                Token token,
                                String callbackUrl)
Gets the auth url based from the given token and callback url.


send

public abstract HttpConnector.Response send(UrlEncodedParameterMap params,
                                            Endpoint ep,
                                            Token token,
                                            TokenExchange exchange,
                                            NonceAndTimestamp nts,
                                            Signature signature,
                                            HttpConnector connector)
                                     throws IOException
Sends the params to the service provided and returns the http response HttpConnector.Response.

Throws:
IOException

getName

public abstract String getName()
Gets the name of this transport.


getMethod

public abstract String getMethod()
Gets the method name of this transport.


handleRequestParameter

public final void handleRequestParameter(String key,
                                         String value,
                                         StringBuilder buffer)
Description copied from interface: Signature.Listener
Handles the encoded request key and value.

Specified by:
handleRequestParameter in interface Signature.Listener

putDefaults

public final void putDefaults(UrlEncodedParameterMap params,
                              Endpoint ep,
                              Token token,
                              TokenExchange exchange,
                              NonceAndTimestamp nts,
                              Signature signature,
                              StringBuilder oauthBuffer,
                              StringBuilder requestBuffer)
Put the default oauth parameters on the UrlEncodedParameterMap params.



Copyright © 2008-2013. All Rights Reserved.