Package org.apache.catalina.core
Class StandardEngine
- java.lang.Object
-
- org.apache.catalina.util.LifecycleBase
-
- org.apache.catalina.util.LifecycleMBeanBase
-
- org.apache.catalina.core.ContainerBase
-
- org.apache.catalina.core.StandardEngine
-
- All Implemented Interfaces:
javax.management.MBeanRegistration,Container,Engine,JmxEnabled,Lifecycle
public class StandardEngine extends ContainerBase implements Engine
Standard implementation of the Engine interface. Each child container must be a Host implementation to process the specific fully qualified host name of that virtual host.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classStandardEngine.AccessLogListenerprotected static classStandardEngine.NoopAccessLog-
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.ContainerBackgroundProcessorMonitor, ContainerBase.PrivilegedAddChild
-
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.core.ContainerBase
accessLog, backgroundProcessorDelay, backgroundProcessorFuture, children, cluster, listeners, logger, logName, monitorFuture, name, parent, parentClassLoader, pipeline, sm, startChildren, startStopExecutor, support
-
Fields inherited from interface org.apache.catalina.Container
ADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENT
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description StandardEngine()Create a new StandardEngine component with the default basic Valve.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(Container child)Add a new child Container to those associated with this Container, if supported.java.io.FilegetCatalinaBase()Obtain the location of CATALINA_BASE.java.io.FilegetCatalinaHome()Obtain the location of CATALINA_HOME.java.lang.StringgetDefaultHost()protected java.lang.StringgetDomainInternal()Method implemented by subclasses to identify the domain in which MBeans should be registered.java.lang.StringgetJvmRoute()protected java.lang.StringgetObjectNameKeyProperties()Allow subclasses to specify the key properties component of theObjectNamethat will be used to register this component.java.lang.ClassLoadergetParentClassLoader()Get the parent class loader.RealmgetRealm()Obtain the Realm with which this Container is associated.ServicegetService()protected voidinitInternal()Subclasses implement this method to perform any instance initialisation required.voidlogAccess(Request request, Response response, long time, boolean useDefault)Log a request/response that was destined for this container but has been handled earlier in the processing chain so that the request/response still appears in the correct access logs.voidsetDefaultHost(java.lang.String host)Set the default hostname for this Engine.voidsetJvmRoute(java.lang.String routeId)Set the JvmRouteId for this engine.voidsetParent(Container container)Disallow any attempt to set a parent for this Container, since an Engine is supposed to be at the top of the Container hierarchy.voidsetService(Service service)Set theServicewith which we are associated (if any).protected voidstartInternal()Start this component and implement the requirements ofLifecycleBase.startInternal().-
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addPropertyChangeListener, addValve, backgroundProcess, destroyInternal, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getChildren, getCluster, getClusterInternal, getLogger, getLogName, getMBeanKeyProperties, getName, getParent, getPipeline, getRealmInternal, getStartChildren, getStartStopThreads, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParentClassLoader, setRealm, setStartChildren, setStartStopThreads, stopInternal, threadStart, threadStop, toString
-
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
-
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.Container
addContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCluster, getDomain, getLogger, getLogName, getMBeanKeyProperties, getName, getObjectName, getParent, getPipeline, getStartStopThreads, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParentClassLoader, setRealm, setStartStopThreads
-
Methods inherited from interface org.apache.catalina.Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
-
-
-
-
Method Detail
-
getRealm
public Realm getRealm()
Description copied from interface:ContainerObtain the Realm with which this Container is associated.- Specified by:
getRealmin interfaceContainer- Overrides:
getRealmin classContainerBase- Returns:
- The associated Realm; if there is no associated Realm, the Realm associated with the parent Container (if
any); otherwise return
null.
-
getDefaultHost
public java.lang.String getDefaultHost()
- Specified by:
getDefaultHostin interfaceEngine- Returns:
- the default host name for this Engine.
-
setDefaultHost
public void setDefaultHost(java.lang.String host)
Description copied from interface:EngineSet the default hostname for this Engine.- Specified by:
setDefaultHostin interfaceEngine- Parameters:
host- The new default host
-
setJvmRoute
public void setJvmRoute(java.lang.String routeId)
Description copied from interface:EngineSet the JvmRouteId for this engine.- Specified by:
setJvmRoutein interfaceEngine- Parameters:
routeId- the (new) JVM Route ID. Each Engine within a cluster must have a unique JVM Route ID.
-
getJvmRoute
public java.lang.String getJvmRoute()
- Specified by:
getJvmRoutein interfaceEngine- Returns:
- the JvmRouteId for this engine.
-
getService
public Service getService()
- Specified by:
getServicein interfaceEngine- Returns:
- the
Servicewith which we are associated (if any).
-
setService
public void setService(Service service)
Description copied from interface:EngineSet theServicewith which we are associated (if any).- Specified by:
setServicein interfaceEngine- Parameters:
service- The service that owns this Engine
-
addChild
public void addChild(Container child)
Add a new child Container to those associated with this Container, if supported. Prior to adding this Container to the set of children, the child'ssetParent()method must be called, with this Container as an argument. This method may throw anIllegalArgumentExceptionif this Container chooses not to be attached to the specified Container, in which case it is not addedThe child must be an implementation of
Host.- Specified by:
addChildin interfaceContainer- Overrides:
addChildin classContainerBase- Parameters:
child- New child Container to be added
-
setParent
public void setParent(Container container)
Disallow any attempt to set a parent for this Container, since an Engine is supposed to be at the top of the Container hierarchy.- Specified by:
setParentin interfaceContainer- Overrides:
setParentin classContainerBase- Parameters:
container- Proposed parent Container
-
initInternal
protected void initInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSubclasses implement this method to perform any instance initialisation required.- Overrides:
initInternalin classLifecycleMBeanBase- Throws:
LifecycleException- If the initialisation fails
-
startInternal
protected void startInternal() throws LifecycleExceptionDescription copied from class:ContainerBaseStart this component and implement the requirements ofLifecycleBase.startInternal().- Overrides:
startInternalin classContainerBase- Throws:
LifecycleException- if this component detects a fatal error that prevents this component from being used
-
logAccess
public void logAccess(Request request, Response response, long time, boolean useDefault)
Log a request/response that was destined for this container but has been handled earlier in the processing chain so that the request/response still appears in the correct access logs.Override the default implementation. If no access log is defined for the Engine, look for one in the Engine's default host and then the default host's ROOT context. If still none is found, return the default NoOp access log.
- Specified by:
logAccessin interfaceContainer- Overrides:
logAccessin classContainerBase- Parameters:
request- Request (associated with the response) to logresponse- Response (associated with the request) to logtime- Time taken to process the request/response in nanoseconds (use 0 if not known)useDefault- Flag that indicates that the request/response should be logged in the engine's default access log
-
getParentClassLoader
public java.lang.ClassLoader getParentClassLoader()
Description copied from interface:ContainerGet the parent class loader.- Specified by:
getParentClassLoaderin interfaceContainer- Overrides:
getParentClassLoaderin classContainerBase- Returns:
- the parent class loader for this component. If not set, return
Container.getParent().Container.getParentClassLoader(). If no parent has been set, return the system class loader.
-
getCatalinaBase
public java.io.File getCatalinaBase()
Description copied from interface:ContainerObtain the location of CATALINA_BASE.- Specified by:
getCatalinaBasein interfaceContainer- Overrides:
getCatalinaBasein classContainerBase- Returns:
- The location of CATALINA_BASE.
-
getCatalinaHome
public java.io.File getCatalinaHome()
Description copied from interface:ContainerObtain the location of CATALINA_HOME.- Specified by:
getCatalinaHomein interfaceContainer- Overrides:
getCatalinaHomein classContainerBase- Returns:
- The location of CATALINA_HOME.
-
getObjectNameKeyProperties
protected java.lang.String getObjectNameKeyProperties()
Description copied from class:LifecycleMBeanBaseAllow subclasses to specify the key properties component of theObjectNamethat will be used to register this component.- Specified by:
getObjectNameKeyPropertiesin classLifecycleMBeanBase- Returns:
- The string representation of the key properties component of the desired
ObjectName
-
getDomainInternal
protected java.lang.String getDomainInternal()
Description copied from class:LifecycleMBeanBaseMethod implemented by subclasses to identify the domain in which MBeans should be registered.- Overrides:
getDomainInternalin classContainerBase- Returns:
- The name of the domain to use to register MBeans.
-
-