Class DevAppServerImpl
java.lang.Object
com.google.appengine.tools.development.DevAppServerImpl
- All Implemented Interfaces:
DevAppServer
DevAppServer launches 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.-
Field Summary
FieldsFields inherited from interface com.google.appengine.tools.development.DevAppServer
DEFAULT_HTTP_ADDRESS, DEFAULT_HTTP_PORT -
Constructor Summary
ConstructorsConstructorDescriptionDevAppServerImpl(File appDir, File externalResourceDir, File webXmlLocation, File appEngineWebXmlLocation, String address, int port, boolean useCustomStreamHandler, Map<String, Object> requestedContainerConfigProperties, String applicationId) Constructs a development application server that runs the application located in the given WAR or EAR directory. -
Method Summary
Modifier and TypeMethodDescriptionReturns theAppContextfor the main container.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()Get the properties that are used by the local services to configure themselves.voidShut down the server after all outstanding requests have completed.restart()Restart the server to reload disk and class changes.voidvoidsetServiceProperties(Map<String, 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.start()Starts the server.
-
Field Details
-
MODULES_FILTER_HELPER_PROPERTY
- See Also:
-
-
Constructor Details
-
DevAppServerImpl
public DevAppServerImpl(File appDir, File externalResourceDir, File webXmlLocation, File appEngineWebXmlLocation, String address, int port, boolean useCustomStreamHandler, Map<String, Object> requestedContainerConfigProperties, String applicationId) Constructs a development application server that runs the application located in the given WAR or EAR directory.- Parameters:
appDir- The location of the application to run.externalResourceDir- If notnull, a resource directory external to the appDir. This will be searched before appDir when looking for resources.webXmlLocation- The location of a file whose format complies with http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd. Ifnull, defaults to/WEB-INF/web.xml appEngineWebXmlLocation- The name of the app engine config file. Ifnull, defaults to/WEB-INF/appengine-web.xml address- The address on which to runport- The port on which to runuseCustomStreamHandler- Iftrue(typical), installStreamHandlerFactory.requestedContainerConfigProperties- Additional properties used in the configuration of the specific container implementation.applicationId- The custom application ID. Ifnull, defaults to use the primary module's application ID.
-
-
Method Details
-
setServiceProperties
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.- Specified by:
setServicePropertiesin interfaceDevAppServer- Parameters:
properties- a, maybenull, set of properties.- Throws:
IllegalStateException- if the server has already been started.
-
getServiceProperties
Description copied from interface:DevAppServerGet the properties that are used by the local services to configure themselves.- Specified by:
getServicePropertiesin interfaceDevAppServer- Returns:
- service properties.
-
start
Starts the server.- Specified by:
startin interfaceDevAppServer- Returns:
- a latch that will be decremented to zero when the server is shutdown.
- Throws:
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.Exception
-
setInboundServicesProperty
public void setInboundServicesProperty() -
restart
Description copied from interface:DevAppServerRestart the server to reload disk and class changes.- Specified by:
restartin interfaceDevAppServer- Returns:
- a latch that will be decremented to zero when the server is shutdown or restarted.
- Throws:
Exception
-
shutdown
Description copied from interface:DevAppServerShut down the server.- Specified by:
shutdownin interfaceDevAppServer- Throws:
Exception
-
gracefulShutdown
Description copied from interface:DevAppServerShut down the server after all outstanding requests have completed.- Specified by:
gracefulShutdownin interfaceDevAppServer- Throws:
IllegalStateException
-
getPort
public int getPort()- Specified by:
getPortin interfaceDevAppServer- Returns:
- the servlet container listener port number.
-
getAppContext
Description copied from interface:DevAppServerReturns theAppContextfor the main container. Useful in embedding scenarios to allow the embedder to install servlets, etc. Any such modification should be done before callingDevAppServer.start().- Specified by:
getAppContextin interfaceDevAppServer- See Also:
-
getCurrentAppContext
Description copied from interface:DevAppServerReturns 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).- Specified by:
getCurrentAppContextin interfaceDevAppServer
-
setThrowOnEnvironmentVariableMismatch
public void setThrowOnEnvironmentVariableMismatch(boolean throwOnMismatch) Description copied from interface:DevAppServerReset the container EnvironmentVariableMismatchSeverity.- Specified by:
setThrowOnEnvironmentVariableMismatchin interfaceDevAppServer
-