Send feedback
  
   
 
  
    
      Class ApiProxyEnvironment (2.0.0) 
  
  
  
   
  
    
  
  
    
    
    
    
    
    
    
    
    
      
  
  
  
    
public   class  ApiProxyEnvironment   implements   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).
Static Fields
   
  AUTH_DOMAIN_HEADER 
  
    
public   static   final   String   AUTH_DOMAIN_HEADER  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  BACKEND_ID_KEY 
  
    
public   static   final   String   BACKEND_ID_KEY  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  BACKGROUND_THREAD_FACTORY_ATTR 
  
    
public   static   final   String   BACKGROUND_THREAD_FACTORY_ATTR  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  
  
    
public   static   final   String   EMAIL_HEADER  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  INSTANCE_ID_KEY 
  
    
public   static   final   String   INSTANCE_ID_KEY  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  
  
    
public   static   final   String   IS_ADMIN_HEADER  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  IS_FEDERATED_USER_KEY 
  
    
public   static   final   String   IS_FEDERATED_USER_KEY  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  
  
    
public   static   final   String   IS_TRUSTED_IP_HEADER  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  IS_TRUSTED_IP_KEY 
  
    
public   static   final   String   IS_TRUSTED_IP_KEY  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  REQUEST_THREAD_FACTORY_ATTR 
  
    
public   static   final   String   REQUEST_THREAD_FACTORY_ATTR  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  
  
    
public   static   final   String   TICKET_HEADER  
  
    
      
        Field Value  
      
        Type Description  
      
        String  
     
  
  Static Methods
   
  
  
  
    
public   static   ApiProxyEnvironment   createFromHeaders ( Map<String , String >  envMap ,   HttpRequest   request ,   String   server ,   Timer   wallTimer ,   Long   millisUntilSoftDeadline )  
  
  
  Constructors
   
  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) 
  
    
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  
      
        Name Description  
      
        serverString the host:port address of the VM's HTTP proxy server.
 
      
        ticketString the request ticket (if null the default one will be computed).
 
      
        appIdString the application ID (required if ticket is null).
 
      
        serviceString the module name (required if ticket is null).
 
      
        versionString the major application version (required if ticket is null).
 
      
        instanceString the VM instance ID (required if ticket is null).
 
      
        emailString the user's e-mail address (may be null).
 
      
        adminboolean true if the user is an administrator.
 
      
        authDomainString the user's authentication domain (may be null).
 
      
        wallTimerTimer optional wall clock timer for the current request (required for deadline).
 
      
        millisUntilSoftDeadlineLong optional soft deadline in milliseconds relative to 'wallTimer'.
 
      
        attributesMap <String ,Object >map containing any attributes set on this environment.
 
     
  
  Methods
   
  aSyncApiCallAdded(long maxWaitMs) 
  
    
public   void   aSyncApiCallAdded ( long   maxWaitMs )  
  Notifies the environment that an API call was queued up.
    
      
        Parameter  
      
        Name Description  
      
        maxWaitMslong  
     
  
  
  addLogRecord(ApiProxy.LogRecord record) 
  
    
public   void   addLogRecord ( ApiProxy . LogRecord   record )  
  
  apiCallCompleted() 
  
    
public   void   apiCallCompleted ()  
  Notifies the environment that an API call completed.
apiCallStarted(long maxWaitMs, boolean releasePendingCall) 
  
    
public   void   apiCallStarted ( long   maxWaitMs ,   boolean   releasePendingCall )  
  Notifies the environment that an API call was started.
    
      
        Parameters  
      
        Name Description  
      
        maxWaitMslong  
      
        releasePendingCallboolean If true a pending call semaphore will be released (required if this
                           API call was requested asynchronously).
 
     
  
  
    
      
        Exceptions  
      
        Type Description  
      
        ApiProxyException If the thread was interrupted while waiting for a semaphore.
 
     
  
  flushLogs() 
  
  getAppId() 
  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getAttributes() 
  
    
public   Map<String , Object >  getAttributes ()  
  
  getAuthDomain() 
  
    
public   String   getAuthDomain ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getEmail() 
  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getModuleId() 
  
    
public   String   getModuleId ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getRemainingMillis() 
  
    
public   long   getRemainingMillis ()  
  
    
      
        Returns  
      
        Type Description  
      
        long  
     
  
  getRequestNamespace() 
  
    
public   String   getRequestNamespace ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getServer() 
  
    
public   String   getServer ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getTicket() 
  
    
public   String   getTicket ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getVersionId() 
  
    
public   String   getVersionId ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  isAdmin() 
  
  
  isLoggedIn() 
  
    
public   boolean   isLoggedIn ()  
  
 
     
    
  
  
  
     
  
    
    
      
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-16 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-16 UTC."],[],[]]