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).

Inheritance

java.lang.Object > ApiProxyEnvironment

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

EMAIL_HEADER

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

IS_ADMIN_HEADER

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

IS_TRUSTED_IP_HEADER

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

TICKET_HEADER

public static final String TICKET_HEADER
Field Value
Type Description
String

Static Methods

createFromHeaders(Map<String,String> envMap, HttpRequest request, String server, Timer wallTimer, Long millisUntilSoftDeadline)

public static ApiProxyEnvironment createFromHeaders(Map<String,String> envMap, HttpRequest request, String server, Timer wallTimer, Long millisUntilSoftDeadline)
Parameters
Name Description
envMap Map<String,String>
request HttpRequest
server String
wallTimer Timer
millisUntilSoftDeadline Long
Returns
Type Description
ApiProxyEnvironment

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
server String

the host:port address of the VM's HTTP proxy server.

ticket String

the request ticket (if null the default one will be computed).

appId String

the application ID (required if ticket is null).

service String

the module name (required if ticket is null).

version String

the major application version (required if ticket is null).

instance String

the VM instance ID (required if ticket is null).

email String

the user's e-mail address (may be null).

admin boolean

true if the user is an administrator.

authDomain String

the user's authentication domain (may be null).

wallTimer Timer

optional wall clock timer for the current request (required for deadline).

millisUntilSoftDeadline Long

optional soft deadline in milliseconds relative to 'wallTimer'.

attributes Map<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
maxWaitMs long
Exceptions
Type Description
ApiProxyException

addLogRecord(ApiProxy.LogRecord record)

public void addLogRecord(ApiProxy.LogRecord record)
Parameter
Name Description
record LogRecord

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
maxWaitMs long
releasePendingCall boolean

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()

public void flushLogs()

getAppId()

public String getAppId()
Returns
Type Description
String

getAttributes()

public Map<String,Object> getAttributes()
Returns
Type Description
Map<String,Object>

getAuthDomain()

public String getAuthDomain()
Returns
Type Description
String

getEmail()

public 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()

public boolean isAdmin()
Returns
Type Description
boolean

isLoggedIn()

public boolean isLoggedIn()
Returns
Type Description
boolean