ApiProxy (Google App Engine API for Java)

JavaScript is disabled on your browser.

com.google.apphosting.api

Class ApiProxy

java.lang.Object

com.google.apphosting.api.ApiProxy

public class ApiProxy
extends java.lang.Object

ApiProxy is a static class that serves as the collection point for
all API calls from user code into the application server.
It is responsible for proxying makeSyncCall() calls to a delegate,
which actually implements the API calls. It also stores an
Environment for each thread, which contains additional user-visible
information about the request.

LogRecord represents a single apphosting log entry,
including a Java-specific logging level, a timestamp in
microseconds, and a message, which is a formatted string containing the
rest of the logging information (e.g.

makeSyncCall

Make a synchronous call to the specified method in the specified
API package.

Note: if you have not installed a Delegate and called
setEnvironmentForCurrentThread in this thread before
calling this method, it will act like no API calls are available
(i.e. always throw CallNotFoundException).

Parameters:

packageName - the name of the API package.

methodName - the name of the method within the API package.

request - a byte array containing the serialized form of the
request protocol buffer.

apiConfig - that specifies API-specific configuration
parameters.

Returns:

a byte array containing the serialized form of the
response protocol buffer.

makeAsyncCall

Make an asynchronous call to the specified method in the
specified API package.

Note: if you have not installed a Delegate and called
setEnvironmentForCurrentThread in this thread before
calling this method, it will act like no API calls are available
(i.e. the returned Future will throw CallNotFoundException).

There is a limit to the number of simultaneous asynchronous
API calls (currently 100). Invoking this method while this number
of API calls are outstanding will block.

Parameters:

packageName - the name of the API package.

methodName - the name of the method within the API package.

request - a byte array containing the serialized form of
the request protocol buffer.

getDelegate

Gets the delegate to which we will proxy requests. This should really
only be called from test-code where, for example, you might want to
downcast and invoke methods on a specific implementation that you happen
to know has been installed.

getEnvironmentFactory

setEnvironmentFactory

Set the EnvironmentFactory instance to use, which will be used to create Environment instances
when a thread local one is not set. This should not be used from user-code, and it should only
be called once, with a value that must not be null.