@Beta public abstract class AbstractAppEngineCallbackServlet extends AbstractCallbackServlet
Beta
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>
Warning: starting with version 1.7, usage of this for OAuth 2.0 is deprecated. Instead use AbstractAppEngineAuthorizationCodeCallbackServlet
.
Upgrade warning: in version 1.15 there was an implementation of AbstractCallbackServlet.newJsonFactoryInstance()
that used com.google.api.client.json.jackson.JacksonFactory
, but starting with version
1.16 there is no such implementation.
Constructor and Description |
---|
AbstractAppEngineCallbackServlet() |
Modifier and Type | Method and Description |
---|---|
protected String |
getUserId()
Return the user ID of the user that is logged in.
|
protected HttpTransport |
newHttpTransportInstance()
Create a new
HttpTransport instance. |
doGet, getCompletionCodeQueryParam, getConcreteFlowType, getDeniedRedirectUrl, getHttpTransport, getJsonFactory, getPersistenceManagerFactory, getSuccessRedirectUrl, newJsonFactoryInstance
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected String getUserId()
getUserId
in class AbstractCallbackServlet
IllegalStateException
- Thrown when no user is logged in.protected HttpTransport newHttpTransportInstance()
AbstractCallbackServlet
HttpTransport
instance. Implementations can create any type of applicable
transport and should be as simple as:
new NetHttpTransport();
newHttpTransportInstance
in class AbstractCallbackServlet
HttpTransport
instance for your particular environmentCopyright © 2011–2019 Google. All rights reserved.