Package com.google.appengine.setup
Class ApiProxyEnvironment
java.lang.Object
com.google.appengine.setup.ApiProxyEnvironment
- All Implemented Interfaces:
com.google.apphosting.api.ApiProxy.Environment
public class ApiProxyEnvironment
extends Object
implements com.google.apphosting.api.ApiProxy.Environment
Implements the ApiProxy environment.
Supports instantiation within a request as well as outside the context of a request.
Instances should be registered using ApiProxy.setEnvironmentForCurrentThread(Environment).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionApiProxyEnvironment
(String server, String ticket, String appId, String service, String version, String instance, String email, boolean admin, String authDomain, Timer wallTimer, Long millisUntilSoftDeadline, Map<String, Object> attributes) Constructs a VM AppEngine API environment. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLogRecord
(com.google.apphosting.api.ApiProxy.LogRecord record) void
Notifies the environment that an API call completed.void
apiCallStarted
(long maxWaitMs, boolean releasePendingCall) Notifies the environment that an API call was started.void
aSyncApiCallAdded
(long maxWaitMs) Notifies the environment that an API call was queued up.static ApiProxyEnvironment
createFromHeaders
(Map<String, String> envMap, HttpRequest request, String server, Timer wallTimer, Long millisUntilSoftDeadline) void
getAppId()
getEmail()
long
Deprecated.boolean
isAdmin()
boolean
-
Field Details
-
TICKET_HEADER
- See Also:
-
EMAIL_HEADER
- See Also:
-
IS_ADMIN_HEADER
- See Also:
-
AUTH_DOMAIN_HEADER
- See Also:
-
BACKEND_ID_KEY
- See Also:
-
INSTANCE_ID_KEY
- See Also:
-
REQUEST_THREAD_FACTORY_ATTR
- See Also:
-
BACKGROUND_THREAD_FACTORY_ATTR
- See Also:
-
IS_FEDERATED_USER_KEY
- See Also:
-
IS_TRUSTED_IP_KEY
- See Also:
-
IS_TRUSTED_IP_HEADER
- See Also:
-
-
Constructor Details
-
ApiProxyEnvironment
public ApiProxyEnvironment(String server, String ticket, String appId, String service, String version, String instance, String email, boolean admin, String authDomain, Timer wallTimer, Long millisUntilSoftDeadline, Map<String, Object> attributes) Constructs a VM AppEngine API environment.- Parameters:
server
- the host:port address of the VM's HTTP proxy server.ticket
- the request ticket (if null the default one will be computed).appId
- the application ID (required if ticket is null).service
- the module name (required if ticket is null).version
- the major application version (required if ticket is null).instance
- the VM instance ID (required if ticket is null).email
- the user's e-mail address (may be null).admin
- true if the user is an administrator.authDomain
- the user's authentication domain (may be null).wallTimer
- optional wall clock timer for the current request (required for deadline).millisUntilSoftDeadline
- optional soft deadline in milliseconds relative to 'wallTimer'.attributes
- map containing any attributes set on this environment.
-
-
Method Details
-
createFromHeaders
public static ApiProxyEnvironment createFromHeaders(Map<String, String> envMap, HttpRequest request, String server, Timer wallTimer, Long millisUntilSoftDeadline) -
addLogRecord
public void addLogRecord(com.google.apphosting.api.ApiProxy.LogRecord record) -
flushLogs
public void flushLogs() -
getServer
-
getTicket
-
getAppId
- Specified by:
getAppId
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getModuleId
- Specified by:
getModuleId
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getVersionId
- Specified by:
getVersionId
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getEmail
- Specified by:
getEmail
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
isLoggedIn
public boolean isLoggedIn()- Specified by:
isLoggedIn
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
isAdmin
public boolean isAdmin()- Specified by:
isAdmin
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getAuthDomain
- Specified by:
getAuthDomain
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getRequestNamespace
Deprecated.- Specified by:
getRequestNamespace
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getAttributes
- Specified by:
getAttributes
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
getRemainingMillis
public long getRemainingMillis()- Specified by:
getRemainingMillis
in interfacecom.google.apphosting.api.ApiProxy.Environment
-
aSyncApiCallAdded
public void aSyncApiCallAdded(long maxWaitMs) throws com.google.apphosting.api.ApiProxy.ApiProxyException Notifies the environment that an API call was queued up.- Throws:
com.google.apphosting.api.ApiProxy.ApiProxyException
-
apiCallStarted
public void apiCallStarted(long maxWaitMs, boolean releasePendingCall) throws com.google.apphosting.api.ApiProxy.ApiProxyException Notifies the environment that an API call was started.- Parameters:
releasePendingCall
- If true a pending call semaphore will be released (required if this API call was requested asynchronously).- Throws:
com.google.apphosting.api.ApiProxy.ApiProxyException
- If the thread was interrupted while waiting for a semaphore.
-
apiCallCompleted
public void apiCallCompleted()Notifies the environment that an API call completed.
-