Class ServerWebApp
- All Implemented Interfaces:
EventListener,javax.servlet.ServletContextListener
- Direct Known Subclasses:
HttpFSServerWebApp
Server subclass that implements ServletContextListener
and uses its lifecycle to start and stop the server.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.lib.server.Server
Server.Status -
Field Summary
FieldsFields inherited from class org.apache.hadoop.lib.server.Server
CONF_SERVICES, CONF_SERVICES_EXT, CONF_STARTUP_STATUS, DEFAULT_LOG4J_PROPERTIES -
Constructor Summary
ConstructorsModifierConstructorDescriptionServerWebApp(String name) Constructor.protectedServerWebApp(String name, String homeDir, String configDir, String logDir, String tempDir, org.apache.hadoop.conf.Configuration config) Constructor for testing purposes.protectedServerWebApp(String name, String homeDir, org.apache.hadoop.conf.Configuration config) Constructor for testing purposes. -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextDestroyed(javax.servlet.ServletContextEvent event) Destroys theServletContextListenerwhich destroys the Server.voidcontextInitialized(javax.servlet.ServletContextEvent event) Initializes theServletContextListenerwhich initializes the Server.Returns the hostname:port InetSocketAddress the webserver is listening to.booleanprotected InetSocketAddressResolves the host and port InetSocketAddress the web server is listening to.voidsetAuthority(InetSocketAddress authority) Sets an alternate hostname:port InetSocketAddress to use.static voidsetHomeDirForCurrentThread(String homeDir) Method for testing purposes.Methods inherited from class org.apache.hadoop.lib.server.Server
checkServiceDependencies, destroy, destroyServices, ensureOperational, get, getConfig, getConfigDir, getHomeDir, getLogDir, getName, getPrefix, getPrefixedName, getStatus, getTempDir, init, initConfig, initLog, initServices, loadServices, setService, setStatus
-
Field Details
-
SSL_ENABLED
- See Also:
-
-
Constructor Details
-
ServerWebApp
protected ServerWebApp(String name, String homeDir, String configDir, String logDir, String tempDir, org.apache.hadoop.conf.Configuration config) Constructor for testing purposes. -
ServerWebApp
Constructor for testing purposes. -
ServerWebApp
Constructor. Subclasses must have a default constructor specifying the server name.The server name is used to resolve the Java System properties that define the server home, config, log and temp directories.
The home directory is looked in the Java System property
#SERVER_NAME#.home.dir.The config directory is looked in the Java System property
#SERVER_NAME#.config.dir, if not defined it resolves to the#SERVER_HOME_DIR#/confdirectory.The log directory is looked in the Java System property
#SERVER_NAME#.log.dir, if not defined it resolves to the#SERVER_HOME_DIR#/logdirectory.The temp directory is looked in the Java System property
#SERVER_NAME#.temp.dir, if not defined it resolves to the#SERVER_HOME_DIR#/tempdirectory.- Parameters:
name- server name.
-
-
Method Details
-
setHomeDirForCurrentThread
Method for testing purposes. -
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event) Initializes theServletContextListenerwhich initializes the Server.- Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener- Parameters:
event- servelt context event.
-
resolveAuthority
Resolves the host and port InetSocketAddress the web server is listening to.This implementation looks for the following 2 properties:
- #SERVER_NAME#.http.hostname
- #SERVER_NAME#.http.port
- Returns:
- the host and port InetSocketAddress the web server is listening to.
- Throws:
ServerException- thrown if any of the above 2 properties is not defined.
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent event) Destroys theServletContextListenerwhich destroys the Server.- Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener- Parameters:
event- servelt context event.
-
getAuthority
Returns the hostname:port InetSocketAddress the webserver is listening to.- Returns:
- the hostname:port InetSocketAddress the webserver is listening to.
- Throws:
ServerException
-
setAuthority
Sets an alternate hostname:port InetSocketAddress to use.For testing purposes.
- Parameters:
authority- alterante authority.
-
isSslEnabled
public boolean isSslEnabled()
-