com.google.api.client.extensions.appengine.auth
Class AbstractAppEngineCallbackServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.api.client.extensions.servlet.auth.AbstractCallbackServlet
              extended by com.google.api.client.extensions.appengine.auth.AbstractAppEngineCallbackServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class AbstractAppEngineCallbackServlet
extends AbstractCallbackServlet

This servlet fills in some of the required information for the AbstractCallbackServlet with reasonable defaults for App Engine. It will default the servlet to creating UrlFetchTransport objects whenever an HttpTransport is needed. It will also default the user identifier to the logged in App Engine user. This servlet requires that the App Engine user must be logged in to work correctly. This can be accomplished by adding a security constraint in your web.xml for the path at which this servlet will live.

Example that requires login for all pages:

 
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>any</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>*</role-name>
    </auth-constraint>
  </security-constraint>
 
 

Since:
1.4
Author:
moshenko@google.com (Jacob Moshenko)
See Also:
Serialized Form

Constructor Summary
AbstractAppEngineCallbackServlet()
           
 
Method Summary
protected  String getUserId()
          Return the user ID of the user that is logged in.
protected  HttpTransport newHttpTransportInstance()
          Create a new HttpTransport instance.
protected  JsonFactory newJsonFactoryInstance()
          Create a new JsonFactory instance.
 
Methods inherited from class com.google.api.client.extensions.servlet.auth.AbstractCallbackServlet
doGet, getCompletionCodeQueryParam, getConcreteFlowType, getDeniedRedirectUrl, getHttpTransport, getJsonFactory, getPersistenceManagerFactory, getSuccessRedirectUrl
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAppEngineCallbackServlet

public AbstractAppEngineCallbackServlet()
Method Detail

getUserId

protected String getUserId()
Return the user ID of the user that is logged in.

Specified by:
getUserId in class AbstractCallbackServlet
Returns:
Get a string representation of a userId that can be used to associate credentials and flows with a specific user.
Throws:
IllegalStateException - Thrown when no user is logged in.

newHttpTransportInstance

protected HttpTransport newHttpTransportInstance()
Description copied from class: AbstractCallbackServlet
Create a new HttpTransport instance. Implementations can create any type of applicable transport and should be as simple as:
  new NetHttpTransport();
 

Specified by:
newHttpTransportInstance in class AbstractCallbackServlet
Returns:
HttpTransport instance for your particular environment

newJsonFactoryInstance

protected JsonFactory newJsonFactoryInstance()
Description copied from class: AbstractCallbackServlet
Create a new JsonFactory instance. Implementations can create any type of applicable json factory and should be as simple as:
  new JacksonFactory();
 

Specified by:
newJsonFactoryInstance in class AbstractCallbackServlet
Returns:
JsonFactory instance for your particular environment


Copyright © 2011 Google. All Rights Reserved.