Top Description Inners Fields Constructors Methods
org.apache.catalina.core

public Class StandardEngine

extends ContainerBase
implements Engine
Class Inheritance
All Implemented Interfaces
org.apache.catalina.Engine, org.apache.catalina.Container, org.apache.catalina.Lifecycle
Imports
java.beans.PropertyChangeEvent, .PropertyChangeListener, java.io.File, java.util.Locale, java.util.concurrent.atomic.AtomicReference, org.apache.catalina.AccessLog, .Container, .ContainerEvent, .ContainerListener, .Context, .Engine, .Host, .LifecycleEvent, .LifecycleException, .LifecycleListener, .Realm, .Server, .Service, org.apache.catalina.connector.Request, .Response, org.apache.catalina.realm.NullRealm, org.apache.catalina.util.ServerInfo, org.apache.juli.logging.Log, .LogFactory

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.
Author
Craig R. McClanahan

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class

Field Summary

Modifier and TypeField and Description
private final AtomicReference<AccessLog>
defaultAccessLog

Default access log to use for request/response pairs where we can't ID the intended host and context.

private String
defaultHost

Host name to use when no server host, or an unknown host, is specified in the request.

private String
jvmRouteId

The JVM Route ID for this Tomcat instance.

private static final Log
private Service
service

The Service that owns this Engine, if any.

Inherited from org.apache.catalina.core.ContainerBase:
accessLogbackgroundProcessorDelaybackgroundProcessorFuturechildrenclusterlistenersloggerlogNamemonitorFuturenameparentparentClassLoaderpipelinesmstartChildrenstartStopExecutorsupport

Constructor Summary

AccessConstructor and Description
public
StandardEngine()

Create a new StandardEngine component with the default basic Valve.

Method Summary

Modifier and TypeMethod and Description
public void
addChild(Container
Child container to be added
child
)

Overrides org.apache.catalina.core.ContainerBase.addChild.

Implements org.apache.catalina.Container.addChild.

Add a child Container, only if the proposed child is an implementation of Host.

public File
public File
public String
getDefaultHost()

Implements org.apache.catalina.Engine.getDefaultHost.

Return the default host.

protected String
getDomainInternal()

Overrides org.apache.catalina.core.ContainerBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

public String
getJvmRoute()

Implements org.apache.catalina.Engine.getJvmRoute.

Retrieve the cluster-wide unique identifier for this Engine.

protected String
getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

public ClassLoader
public Realm

Returns:

configured realm, or a NullRealm by default
getRealm
()

Overrides org.apache.catalina.core.ContainerBase.getRealm.

Implements org.apache.catalina.Container.getRealm.

Obtain the configured Realm and provide a default Realm implementation when no explicit configuration is set.

public Service
getService()

Implements org.apache.catalina.Engine.getService.

Return the Service with which we are associated (if any).

protected void
initInternal()

Overrides org.apache.catalina.util.LifecycleMBeanBase.initInternal.

Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.

public void
logAccess(Request
Request (associated with the response) to log
request
,
Response
Response (associated with the request) to log
response
,
long
Time taken to process the request/response in milliseconds (use 0 if not known)
time
,
boolean
Flag that indicates that the request/response should be logged in the engine's default access log
useDefault
)

Overrides org.apache.catalina.core.ContainerBase.logAccess.

Implements org.apache.catalina.Container.logAccess.

Override the default implementation.

public void
setDefaultHost(String
The new default host
host
)

Implements org.apache.catalina.Engine.setDefaultHost.

Set the default host.

public void
setJvmRoute(String
the (new) JVM Route ID. Each Engine within a cluster must have a unique JVM Route ID.
routeId
)

Implements org.apache.catalina.Engine.setJvmRoute.

Set the cluster-wide unique identifier for this Engine.

public void
setParent(Container
Proposed parent Container
container
)

Overrides org.apache.catalina.core.ContainerBase.setParent.

Implements org.apache.catalina.Container.setParent.

Disallow any attempt to set a parent for this Container, since an Engine is supposed to be at the top of the Container hierarchy.

public void
setService(Service
The service that owns this Engine
service
)

Implements org.apache.catalina.Engine.setService.

Set the Service with which we are associated (if any).

protected void
Inherited from org.apache.catalina.core.ContainerBase:
addContainerListeneraddPropertyChangeListeneraddValvebackgroundProcessdestroyInternalfindChildfindChildrenfindContainerListenersfireContainerEventgetAccessLoggetBackgroundProcessorDelaygetChildrengetClustergetClusterInternalgetLoggergetLogNamegetMBeanKeyPropertiesgetNamegetParentgetPipelinegetRealmInternalgetStartChildrengetStartStopThreadsremoveChildremoveContainerListenerremovePropertyChangeListenersetBackgroundProcessorDelaysetClustersetNamesetParentClassLoadersetRealmsetStartChildrensetStartStopThreadsstopInternalthreadStartthreadStoptoString

Field Detail

defaultAccessLogback to summary
private final AtomicReference<AccessLog> defaultAccessLog

Default access log to use for request/response pairs where we can't ID the intended host and context.

defaultHostback to summary
private String defaultHost

Host name to use when no server host, or an unknown host, is specified in the request.

jvmRouteIdback to summary
private String jvmRouteId

The JVM Route ID for this Tomcat instance. All Route ID's must be unique across the cluster.

logback to summary
private static final Log log

Hides org.apache.catalina.core.ContainerBase.log.

serviceback to summary
private Service service

The Service that owns this Engine, if any.

Constructor Detail

StandardEngineback to summary
public StandardEngine()

Create a new StandardEngine component with the default basic Valve.

Method Detail

addChildback to summary
public void addChild(Container child)

Overrides org.apache.catalina.core.ContainerBase.addChild.

Implements org.apache.catalina.Container.addChild.

Add a child Container, only if the proposed child is an implementation of Host.

Parameters
child:Container

Child container to be added

Annotations
@Override
getCatalinaBaseback to summary
public File getCatalinaBase()

Overrides org.apache.catalina.core.ContainerBase.getCatalinaBase.

Implements org.apache.catalina.Container.getCatalinaBase.

Doc from org.apache.catalina.Container.getCatalinaBase.

Obtain the location of CATALINA_BASE.

Returns:File

The location of CATALINA_BASE.

Annotations
@Override
getCatalinaHomeback to summary
public File getCatalinaHome()

Overrides org.apache.catalina.core.ContainerBase.getCatalinaHome.

Implements org.apache.catalina.Container.getCatalinaHome.

Doc from org.apache.catalina.Container.getCatalinaHome.

Obtain the location of CATALINA_HOME.

Returns:File

The location of CATALINA_HOME.

Annotations
@Override
getDefaultHostback to summary
public String getDefaultHost()

Implements org.apache.catalina.Engine.getDefaultHost.

Return the default host.

Returns:String

Doc from org.apache.catalina.Engine.getDefaultHost.

the default host name for this Engine.

Annotations
@Override
getDomainInternalback to summary
protected String getDomainInternal()

Overrides org.apache.catalina.core.ContainerBase.getDomainInternal.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

Returns:String

The name of the domain to use to register MBeans.

Annotations
@Override
getJvmRouteback to summary
public String getJvmRoute()

Implements org.apache.catalina.Engine.getJvmRoute.

Retrieve the cluster-wide unique identifier for this Engine. This value is only useful in a load-balancing scenario.

Returns:String

Doc from org.apache.catalina.Engine.getJvmRoute.

the JvmRouteId for this engine.

Annotations
@Override
getObjectNameKeyPropertiesback to summary
protected String getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

Returns:String

The string representation of the key properties component of the desired ObjectName

Annotations
@Override
getParentClassLoaderback to summary
public ClassLoader getParentClassLoader()

Overrides org.apache.catalina.core.ContainerBase.getParentClassLoader.

Implements org.apache.catalina.Container.getParentClassLoader.

Return the parent class loader for this component.

Returns:ClassLoader

Doc from org.apache.catalina.Container.getParentClassLoader.

the parent class loader for this component. If not set, return getParent().getParentClassLoader(). If no parent has been set, return the system class loader.

Annotations
@Override
getRealmback to summary
public Realm getRealm()

Overrides org.apache.catalina.core.ContainerBase.getRealm.

Implements org.apache.catalina.Container.getRealm.

Obtain the configured Realm and provide a default Realm implementation when no explicit configuration is set.

Returns:Realm

configured realm, or a NullRealm by default

Annotations
@Override
getServiceback to summary
public Service getService()

Implements org.apache.catalina.Engine.getService.

Return the Service with which we are associated (if any).

Returns:Service

Doc from org.apache.catalina.Engine.getService.

the Service with which we are associated (if any).

Annotations
@Override
initInternalback to summary
protected void initInternal() throws LifecycleException

Overrides org.apache.catalina.util.LifecycleMBeanBase.initInternal.

Doc from org.apache.catalina.util.LifecycleMBeanBase.initInternal.

Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.

Annotations
@Override
Exceptions
LifecycleException:

Doc from org.apache.catalina.util.LifecycleBase.initInternal.

If the initialisation fails

logAccessback to summary
public void logAccess(Request request, Response response, long time, boolean useDefault)

Overrides org.apache.catalina.core.ContainerBase.logAccess.

Implements org.apache.catalina.Container.logAccess.

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.

Parameters
request:Request

Doc from org.apache.catalina.Container.logAccess.

Request (associated with the response) to log

response:Response

Doc from org.apache.catalina.Container.logAccess.

Response (associated with the request) to log

time:long

Doc from org.apache.catalina.Container.logAccess.

Time taken to process the request/response in milliseconds (use 0 if not known)

useDefault:boolean

Doc from org.apache.catalina.Container.logAccess.

Flag that indicates that the request/response should be logged in the engine's default access log

Annotations
@Override
setDefaultHostback to summary
public void setDefaultHost(String host)

Implements org.apache.catalina.Engine.setDefaultHost.

Set the default host.

Parameters
host:String

The new default host

Annotations
@Override
setJvmRouteback to summary
public void setJvmRoute(String routeId)

Implements org.apache.catalina.Engine.setJvmRoute.

Set the cluster-wide unique identifier for this Engine. This value is only useful in a load-balancing scenario.

This property should not be changed once it is set.

Parameters
routeId:String

Doc from org.apache.catalina.Engine.setJvmRoute.

the (new) JVM Route ID. Each Engine within a cluster must have a unique JVM Route ID.

Annotations
@Override
setParentback to summary
public void setParent(Container container)

Overrides org.apache.catalina.core.ContainerBase.setParent.

Implements org.apache.catalina.Container.setParent.

Disallow any attempt to set a parent for this Container, since an Engine is supposed to be at the top of the Container hierarchy.

Parameters
container:Container

Proposed parent Container

Annotations
@Override
setServiceback to summary
public void setService(Service service)

Implements org.apache.catalina.Engine.setService.

Set the Service with which we are associated (if any).

Parameters
service:Service

The service that owns this Engine

Annotations
@Override
startInternalback to summary
protected void startInternal() throws LifecycleException

Overrides org.apache.catalina.core.ContainerBase.startInternal.

Start this component and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal().

Annotations
@Override
Exceptions
LifecycleException:
if this component detects a fatal error that prevents this component from being used
org.apache.catalina.core back to summary

protected final Class StandardEngine.AccessLogListener

extends Object
implements PropertyChangeListener, LifecycleListener, ContainerListener
Class Inheritance
All Implemented Interfaces
org.apache.catalina.ContainerListener, org.apache.catalina.LifecycleListener, java.beans.PropertyChangeListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private final Context
private volatile boolean
private final StandardEngine
private final Host

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
containerEvent(ContainerEvent
ContainerEvent that has occurred
event
)

Implements org.apache.catalina.ContainerListener.containerEvent.

Acknowledge the occurrence of the specified event.

public void
public void
lifecycleEvent(LifecycleEvent
LifecycleEvent that has occurred
event
)

Implements org.apache.catalina.LifecycleListener.lifecycleEvent.

Acknowledge the occurrence of the specified event.

public void
propertyChange(PropertyChangeEvent
A PropertyChangeEvent object describing the event source and the property that has changed.
evt
)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final Context context
disabledback to summary
private volatile boolean disabled
engineback to summary
private final StandardEngine engine
hostback to summary
private final Host host

Constructor Detail

AccessLogListenerback to summary
public AccessLogListener(StandardEngine engine, Host host, Context context)

Method Detail

containerEventback to summary
public void containerEvent(ContainerEvent event)

Implements org.apache.catalina.ContainerListener.containerEvent.

Doc from org.apache.catalina.ContainerListener.containerEvent.

Acknowledge the occurrence of the specified event.

Parameters
event:ContainerEvent

ContainerEvent that has occurred

Annotations
@Override
installback to summary
public void install()
lifecycleEventback to summary
public void lifecycleEvent(LifecycleEvent event)

Implements org.apache.catalina.LifecycleListener.lifecycleEvent.

Doc from org.apache.catalina.LifecycleListener.lifecycleEvent.

Acknowledge the occurrence of the specified event.

Parameters
event:LifecycleEvent

LifecycleEvent that has occurred

Annotations
@Override
propertyChangeback to summary
public void propertyChange(PropertyChangeEvent evt)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Parameters
evt:PropertyChangeEvent

A PropertyChangeEvent object describing the event source and the property that has changed.

Annotations
@Override
uninstallback to summary
private void uninstall()
org.apache.catalina.core back to summary

protected final Class StandardEngine.NoopAccessLog

extends Object
implements AccessLog
Class Inheritance
All Implemented Interfaces
org.apache.catalina.AccessLog

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
log(Request
Request (associated with the response) to log
request
,
Response
Response (associated with the request) to log
response
,
long
Time taken to process the request/response in nanoseconds (use 0 if not known); in Tomcat versions prior to 10, the time unit was milliseconds
time
)

Implements org.apache.catalina.AccessLog.log.

Add the request/response to the access log using the specified processing time.

public void
setRequestAttributesEnabled(boolean
true causes the attributes to be used, false causes the original values to be used.
requestAttributesEnabled
)

Implements org.apache.catalina.AccessLog.setRequestAttributesEnabled.

Should this valve use request attributes for IP address, hostname, protocol and port used for the request?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NoopAccessLogback to summary
protected NoopAccessLog()

Method Detail

getRequestAttributesEnabledback to summary
public boolean getRequestAttributesEnabled()

Implements org.apache.catalina.AccessLog.getRequestAttributesEnabled.

Returns:boolean

Doc from org.apache.catalina.AccessLog.getRequestAttributesEnabled.

true if the attributes will be logged, otherwise false

Annotations
@Override
logback to summary
public void log(Request request, Response response, long time)

Implements org.apache.catalina.AccessLog.log.

Doc from org.apache.catalina.AccessLog.log.

Add the request/response to the access log using the specified processing time.

Parameters
request:Request

Request (associated with the response) to log

response:Response

Response (associated with the request) to log

time:long

Time taken to process the request/response in nanoseconds (use 0 if not known); in Tomcat versions prior to 10, the time unit was milliseconds

Annotations
@Override
setRequestAttributesEnabledback to summary
public void setRequestAttributesEnabled(boolean requestAttributesEnabled)

Implements org.apache.catalina.AccessLog.setRequestAttributesEnabled.

Doc from org.apache.catalina.AccessLog.setRequestAttributesEnabled.

Should this valve use request attributes for IP address, hostname, protocol and port used for the request? The attributes used are:

  • org.apache.catalina.RemoteAddr
  • org.apache.catalina.RemoteHost
  • org.apache.catalina.Protocol
  • org.apache.catalina.ServerName
  • org.apache.catalina.ServerPost
Parameters
requestAttributesEnabled:boolean

true causes the attributes to be used, false causes the original values to be used.

Annotations
@Override