# Class ContextNamingInfoListener

java.lang.Object
org.apache.catalina.core.ContextNamingInfoListener

All Implemented Interfaces:
  `LifecycleListener`

public class ContextNamingInfoListener extends Object implements LifecycleListener
Implementation of `LifecycleListener` that will create context naming information environment entries.

This listener must only be nested within `Context` elements.

The following entries will be added to the initial context (`java:comp/env` implied):

- Path: `context/path` from `Context.getPath()`
- Encoded Path: `context/encodedPath` from `Context.getEncodedPath()`
- Webapp Version: `context/webappVersion` from `Context.getWebappVersion()`
- Name: `context/name` from `Container.getName()`
- Base Name: `context/baseName` from `Context.getBaseName()`
- Display Name: `context/displayName` from `Context.getDisplayName()`

See the Tomcat documentation for more details on the values.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContextNamingInfoListener()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isEmptyOnRoot()`
  Gets whether paths and name for the root context will be empty.
  `void`
  `lifecycleEvent(LifecycleEvent event)`
  Acknowledge the occurrence of the specified event.
  `void`
  `setEmptyOnRoot(boolean emptyOnRoot)`
  Sets whether for the root context `context/path` and `context/encodedPath` will contain `"/"` and `context/name` will contain `"ROOT"` with a version, if any.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ContextNamingInfoListener

    public ContextNamingInfoListener()

- ## Method Details

  - ### setEmptyOnRoot

    public void setEmptyOnRoot(boolean emptyOnRoot)
    Sets whether for the root context `context/path` and `context/encodedPath` will contain `"/"` and `context/name` will contain `"ROOT"` with a version, if any.
    Parameters:
      `emptyOnRoot` - whether paths and name for root context shall be empty

  - ### isEmptyOnRoot

    public boolean isEmptyOnRoot()
    Gets whether paths and name for the root context will be empty.
    Returns:
      indicator whether paths and name for the root context will be empty

  - ### lifecycleEvent

    public void lifecycleEvent(LifecycleEvent event)
    Description copied from interface: `LifecycleListener`
    Acknowledge the occurrence of the specified event.
    Specified by:
      `lifecycleEvent` in interface `LifecycleListener`
    Parameters:
      `event` - LifecycleEvent that has occurred