com.google.appengine.tools.development
Interface DevAppServer
-
public interface DevAppServerDevAppServerlaunches a local Jetty server (by default) with a single hosted web application. It can be invoked from the command-line by providing the path to the directory in which the application resides as the only argument. Over time, the environment provided by this class should come to resemble the environment provided to hosted applications in production. For example, stub applications of all of the API's should be provided, and similar security restrictions should be enforced.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringDEFAULT_HTTP_ADDRESSDevAppServerlistens on this network address for incoming HTTP requests.static intDEFAULT_HTTP_PORTDevAppServerlistens on this port for incoming HTTP requests.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description com.google.appengine.tools.development.AppContextgetAppContext()Returns theAppContextfor the main container.com.google.appengine.tools.development.AppContextgetCurrentAppContext()Returns theAppContextcorresponding to the HTTP request (or background thread) associated with the current thread, ornullif the current thread is not associated with any HTTP request (or background thread).intgetPort()java.util.Map<java.lang.String,java.lang.String>getServiceProperties()Get the properties that are used by the local services to configure themselves.voidgracefulShutdown()Shut down the server after all outstanding requests have completed.java.util.concurrent.CountDownLatchrestart()Restart the server to reload disk and class changes.voidsetServiceProperties(java.util.Map<java.lang.String,java.lang.String> properties)Sets the properties that will be used by the local services to configure themselves.voidsetThrowOnEnvironmentVariableMismatch(boolean throwOnMismatch)Reset the container EnvironmentVariableMismatchSeverity.voidshutdown()Shut down the server.java.util.concurrent.CountDownLatchstart()Starts the server.
-
-
-
Field Detail
-
DEFAULT_HTTP_ADDRESS
static final java.lang.String DEFAULT_HTTP_ADDRESS
DevAppServerlistens on this network address for incoming HTTP requests. This can be overriden with--address=<addr>.- See Also:
- Constant Field Values
-
DEFAULT_HTTP_PORT
static final int DEFAULT_HTTP_PORT
DevAppServerlistens on this port for incoming HTTP requests. This can be overriden with--port=NNNN.- See Also:
- Constant Field Values
-
-
Method Detail
-
setServiceProperties
void setServiceProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Sets the properties that will be used by the local services to configure themselves. This method must be called before the server has been started.- Parameters:
properties- a, maybenull, set of properties.- Throws:
java.lang.IllegalStateException- if the server has already been started.
-
getServiceProperties
java.util.Map<java.lang.String,java.lang.String> getServiceProperties()
Get the properties that are used by the local services to configure themselves.- Returns:
- service properties.
-
start
java.util.concurrent.CountDownLatch start() throws java.lang.ExceptionStarts the server.- Returns:
- a latch that will be decremented to zero when the server is shutdown or restarted.
- Throws:
java.lang.IllegalStateException- If the server has already been started or shutdown.com.google.apphosting.utils.config.AppEngineConfigException- If no WEB-INF directory can be found or WEB-INF/appengine-web.xml does not exist.java.lang.Exception
-
restart
java.util.concurrent.CountDownLatch restart() throws java.lang.ExceptionRestart the server to reload disk and class changes.- Returns:
- a latch that will be decremented to zero when the server is shutdown or restarted.
- Throws:
java.lang.IllegalStateException- If the server has not been started or has already been shutdown.java.lang.Exception
-
shutdown
void shutdown() throws java.lang.ExceptionShut down the server.- Throws:
java.lang.IllegalStateException- If the server has not been started or has already been shutdown.java.lang.Exception
-
gracefulShutdown
void gracefulShutdown()
Shut down the server after all outstanding requests have completed.
-
getPort
int getPort()
- Returns:
- the servlet container listener port number.
-
getAppContext
com.google.appengine.tools.development.AppContext getAppContext()
Returns theAppContextfor the main container. Useful in embedding scenarios to allow the embedder to install servlets, etc. Any such modification should be done before callingstart().- See Also:
ContainerService.getAppContext()
-
getCurrentAppContext
com.google.appengine.tools.development.AppContext getCurrentAppContext()
Returns theAppContextcorresponding to the HTTP request (or background thread) associated with the current thread, ornullif the current thread is not associated with any HTTP request (or background thread).
-
setThrowOnEnvironmentVariableMismatch
void setThrowOnEnvironmentVariableMismatch(boolean throwOnMismatch)
Reset the container EnvironmentVariableMismatchSeverity.
-
-