Class StandardEngine

All Implemented Interfaces:
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.
The jvmRoute should be set directly like any other property. Using the System property jvmRoute is deprecated and will be removed in Tomcat 10.1 onwards.
Author:
Craig R. McClanahan
  • Constructor Details

    • StandardEngine

      public StandardEngine()
      Create a new StandardEngine component with the default basic Valve.
  • Method Details

    • getRealm

      public Realm getRealm()
      Description copied from interface: Container
      Obtain the Realm with which this Container is associated.
      Specified by:
      getRealm in interface Container
      Overrides:
      getRealm in class ContainerBase
      Returns:
      The associated Realm; if there is no associated Realm, the Realm associated with the parent Container (if any); otherwise return null.
    • getDefaultHost

      public String getDefaultHost()
      Specified by:
      getDefaultHost in interface Engine
      Returns:
      the default host name for this Engine.
    • setDefaultHost

      public void setDefaultHost(String host)
      Description copied from interface: Engine
      Set the default hostname for this Engine.
      Specified by:
      setDefaultHost in interface Engine
      Parameters:
      host - The new default host
    • setJvmRoute

      public void setJvmRoute(String routeId)
      Description copied from interface: Engine
      Set the JvmRouteId for this engine.
      Specified by:
      setJvmRoute in interface Engine
      Parameters:
      routeId - the (new) JVM Route ID. Each Engine within a cluster must have a unique JVM Route ID.
    • getJvmRoute

      public String getJvmRoute()
      Specified by:
      getJvmRoute in interface Engine
      Returns:
      the JvmRouteId for this engine.
    • getService

      public Service getService()
      Specified by:
      getService in interface Engine
      Returns:
      the Service with which we are associated (if any).
    • setService

      public void setService(Service service)
      Description copied from interface: Engine
      Set the Service with which we are associated (if any).
      Specified by:
      setService in interface Engine
      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's setParent() method must be called, with this Container as an argument. This method may thrown an IllegalArgumentException if this Container chooses not to be attached to the specified Container, in which case it is not added

      The child must be an implementation of Host.

      Specified by:
      addChild in interface Container
      Overrides:
      addChild in class ContainerBase
      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:
      setParent in interface Container
      Overrides:
      setParent in class ContainerBase
      Parameters:
      container - Proposed parent Container
    • initInternal

      protected void initInternal() throws LifecycleException
      Description copied from class: LifecycleBase
      Sub-classes implement this method to perform any instance initialisation required.
      Overrides:
      initInternal in class LifecycleMBeanBase
      Throws:
      LifecycleException - If the initialisation fails
    • startInternal

      protected void startInternal() throws LifecycleException
      Description copied from class: ContainerBase
      Start this component and implement the requirements of LifecycleBase.startInternal().
      Overrides:
      startInternal in class ContainerBase
      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:
      logAccess in interface Container
      Overrides:
      logAccess in class ContainerBase
      Parameters:
      request - Request (associated with the response) to log
      response - Response (associated with the request) to log
      time - Time taken to process the request/response in milliseconds (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 ClassLoader getParentClassLoader()
      Description copied from interface: Container
      Get the parent class loader.
      Specified by:
      getParentClassLoader in interface Container
      Overrides:
      getParentClassLoader in class ContainerBase
      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 File getCatalinaBase()
      Description copied from interface: Container
      Obtain the location of CATALINA_BASE.
      Specified by:
      getCatalinaBase in interface Container
      Overrides:
      getCatalinaBase in class ContainerBase
      Returns:
      The location of CATALINA_BASE.
    • getCatalinaHome

      public File getCatalinaHome()
      Description copied from interface: Container
      Obtain the location of CATALINA_HOME.
      Specified by:
      getCatalinaHome in interface Container
      Overrides:
      getCatalinaHome in class ContainerBase
      Returns:
      The location of CATALINA_HOME.
    • getObjectNameKeyProperties

      protected String getObjectNameKeyProperties()
      Description copied from class: LifecycleMBeanBase
      Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.
      Specified by:
      getObjectNameKeyProperties in class LifecycleMBeanBase
      Returns:
      The string representation of the key properties component of the desired ObjectName
    • getDomainInternal

      protected String getDomainInternal()
      Description copied from class: LifecycleMBeanBase
      Method implemented by sub-classes to identify the domain in which MBeans should be registered.
      Overrides:
      getDomainInternal in class ContainerBase
      Returns:
      The name of the domain to use to register MBeans.