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 Details

  • 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

      public String getServer()
    • getTicket

      public String getTicket()
    • getAppId

      public String getAppId()
      Specified by:
      getAppId in interface com.google.apphosting.api.ApiProxy.Environment
    • getModuleId

      public String getModuleId()
      Specified by:
      getModuleId in interface com.google.apphosting.api.ApiProxy.Environment
    • getVersionId

      public String getVersionId()
      Specified by:
      getVersionId in interface com.google.apphosting.api.ApiProxy.Environment
    • getEmail

      public String getEmail()
      Specified by:
      getEmail in interface com.google.apphosting.api.ApiProxy.Environment
    • isLoggedIn

      public boolean isLoggedIn()
      Specified by:
      isLoggedIn in interface com.google.apphosting.api.ApiProxy.Environment
    • isAdmin

      public boolean isAdmin()
      Specified by:
      isAdmin in interface com.google.apphosting.api.ApiProxy.Environment
    • getAuthDomain

      public String getAuthDomain()
      Specified by:
      getAuthDomain in interface com.google.apphosting.api.ApiProxy.Environment
    • getRequestNamespace

      @Deprecated public String getRequestNamespace()
      Deprecated.
      Specified by:
      getRequestNamespace in interface com.google.apphosting.api.ApiProxy.Environment
    • getAttributes

      public Map<String,Object> getAttributes()
      Specified by:
      getAttributes in interface com.google.apphosting.api.ApiProxy.Environment
    • getRemainingMillis

      public long getRemainingMillis()
      Specified by:
      getRemainingMillis in interface com.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.