net.oauth.example.consumer.webapp
Class FPConsumer

java.lang.Object
  extended by net.oauth.example.consumer.webapp.CookieConsumer
      extended by net.oauth.example.consumer.webapp.FPConsumer

public abstract class FPConsumer
extends net.oauth.example.consumer.webapp.CookieConsumer

Modification of CookieConsumer to work with FPush adapter. Utility methods for consumers that store tokens and secrets in cookies. Each consumer has a name, and its accessors' credentials are stored in cookies named [name].requestToken, [name].accessToken and [name].tokenSecret.

Author:
John Kristian, Lei Dou $Id$

Field Summary
static net.oauth.client.OAuthClient CLIENT
           
 
Constructor Summary
FPConsumer()
           
 
Method Summary
static void copyResponse(net.oauth.OAuthMessage from, javax.servlet.http.HttpServletResponse into)
           
static net.oauth.OAuthAccessor getAccessor(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.oauth.OAuthConsumer consumer, java.lang.String callBackURL)
          Get the access token and token secret for the given consumer.
static net.oauth.OAuthConsumer getConsumer(java.lang.String name, javax.servlet.ServletContext context)
           
static void handleException(java.lang.Exception e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.oauth.OAuthConsumer consumer, java.lang.String callBackURL, javax.faces.context.FacesContext facesCtx)
          Handle an exception that occurred while processing an HTTP request.
static void removeAccessors(net.oauth.example.consumer.webapp.CookieMap cookies)
          Remove all the cookies that contain accessors' data.
 
Methods inherited from class net.oauth.example.consumer.webapp.CookieConsumer
getAccessor, handleException
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT

public static final net.oauth.client.OAuthClient CLIENT
Constructor Detail

FPConsumer

public FPConsumer()
Method Detail

getConsumer

public static net.oauth.OAuthConsumer getConsumer(java.lang.String name,
                                                  javax.servlet.ServletContext context)
                                           throws java.io.IOException
Throws:
java.io.IOException

getAccessor

public static net.oauth.OAuthAccessor getAccessor(javax.servlet.http.HttpServletRequest request,
                                                  javax.servlet.http.HttpServletResponse response,
                                                  net.oauth.OAuthConsumer consumer,
                                                  java.lang.String callBackURL)
                                           throws net.oauth.OAuthException,
                                                  java.io.IOException,
                                                  java.net.URISyntaxException
Get the access token and token secret for the given consumer. Get them from cookies if possible; otherwise obtain them from the service provider. In the latter case, throw RedirectException.

Throws:
java.io.IOException
java.net.URISyntaxException
net.oauth.OAuthException

removeAccessors

public static void removeAccessors(net.oauth.example.consumer.webapp.CookieMap cookies)
Remove all the cookies that contain accessors' data.


copyResponse

public static void copyResponse(net.oauth.OAuthMessage from,
                                javax.servlet.http.HttpServletResponse into)
                         throws java.io.IOException
Throws:
java.io.IOException

handleException

public static void handleException(java.lang.Exception e,
                                   javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   net.oauth.OAuthConsumer consumer,
                                   java.lang.String callBackURL,
                                   javax.faces.context.FacesContext facesCtx)
                            throws java.io.IOException,
                                   javax.servlet.ServletException,
                                   InternalException
Handle an exception that occurred while processing an HTTP request. Depending on the exception, either send a response, redirect the client or propagate an exception.

Throws:
java.io.IOException
javax.servlet.ServletException
InternalException