com.google.appengine.tools.development
Interface ContainerService

All Known Implementing Classes:
AbstractContainerService

public interface ContainerService

Implementation of this interface provides the actual servlet container support for the DevAppServer, as discovered via the ServiceProvider. More specifically, we encapsulate the interactions between the DevAppServer and the underlying servlet container, which by default uses Jetty.


Nested Class Summary
static class ContainerService.EnvironmentVariableMismatchSeverity
          The severity with which we'll treat environment variable mismatches.
 
Method Summary
 void configure(java.lang.String devAppServerVersion, java.io.File appDir, java.lang.String webXmlLocation, com.google.apphosting.utils.config.AppEngineWebXmlReader appEngineWebXmlReader, java.lang.String address, int port)
          Set up the necessary configuration parameters.
 java.lang.String getAddress()
           
 java.io.File getAppDirectory()
          This allows us to recover the application directory from the container.
 int getPort()
           
 java.security.Permissions getUserPermissions()
          Returns a Permissions object containing UnresolvedPermission instances for every permission that was requested by the user in their appengine-web.xml file.
 java.lang.Object getWebAppContext()
          This allows us to access the "raw" WebAppContext API as provided by the container implementation, e.g.
 void setEnvironmentVariableMismatchSeverity(ContainerService.EnvironmentVariableMismatchSeverity val)
          Override the default EnvironmentVariableMismatchSeverity setting, to disable exceptions during the testing.
 void shutdown()
          Shut down the servlet container.
 void startup()
          Start up the servlet container.
 

Method Detail

configure

void configure(java.lang.String devAppServerVersion,
               java.io.File appDir,
               java.lang.String webXmlLocation,
               com.google.apphosting.utils.config.AppEngineWebXmlReader appEngineWebXmlReader,
               java.lang.String address,
               int port)
Set up the necessary configuration parameters.

Parameters:
devAppServerVersion - Version of the devAppServer.
appDir - The location of the application to run.
webXmlLocation - The location of a file whose format complies with http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd. Can be null.
appEngineWebXmlReader - The reader that will be used to create an instance of AppEngineWebXml. If null, an instance of AppEngineWebXmlReader will be instantiated with appDir as the constructor argument.

startup

void startup()
             throws java.lang.Exception
Start up the servlet container.

Throws:
java.lang.Exception - Any exception from the container will be rethrown as is.

shutdown

void shutdown()
              throws java.lang.Exception
Shut down the servlet container.

Throws:
java.lang.Exception - Any exception from the container will be rethrown as is.

getAddress

java.lang.String getAddress()
Returns:
the listener network address, however it's decided during the servlet container deployment.

getPort

int getPort()
Returns:
the listener port number, however it's decided during the servlet container deployment.

getWebAppContext

java.lang.Object getWebAppContext()
This allows us to access the "raw" WebAppContext API as provided by the container implementation, e.g. to programmatically install servlets or filters.


getAppDirectory

java.io.File getAppDirectory()
This allows us to recover the application directory from the container.


setEnvironmentVariableMismatchSeverity

void setEnvironmentVariableMismatchSeverity(ContainerService.EnvironmentVariableMismatchSeverity val)
Override the default EnvironmentVariableMismatchSeverity setting, to disable exceptions during the testing.

Parameters:
val - The new EnvironmentVariableMismatchSeverity.
See Also:
ContainerService.EnvironmentVariableMismatchSeverity

getUserPermissions

java.security.Permissions getUserPermissions()
Returns a Permissions object containing UnresolvedPermission instances for every permission that was requested by the user in their appengine-web.xml file.

Note that user code will not actually running with these permissions. However, to user-provided code that calls SecurityManager.checkPermission directly it will appear that it is. This is designed primarily for third-party libraries that introduce their own Permission subclasses that are not used by any other classes.