ReplicatedContext.ReplApplContext (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.ha.context, class: ReplicatedContext, class: ReplApplContext

# Class ReplicatedContext.ReplApplContext

java.lang.Object
org.apache.catalina.core.ApplicationContext
org.apache.catalina.ha.context.ReplicatedContext.ReplApplContext

All Implemented Interfaces:
  `ServletContext`

Enclosing class:
  `ReplicatedContext`

protected static class ReplicatedContext.ReplApplContext extends ApplicationContext
Application context implementation for replicated contexts.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Map<String,Object>`
  `tomcatAttributes`
  Map for Tomcat-specific attributes that should not be replicated.

  ### Fields inherited from class ApplicationContext

  `attributes, GET_RESOURCE_REQUIRE_SLASH, STRICT_SERVLET_COMPLIANCE`

  ### Fields inherited from interface ServletContext

  `ORDERED_LIBS, TEMPDIR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReplApplContext(ReplicatedContext context)`
  Create a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getAttribute(String name)`
  Returns the servlet container attribute with the given name, or `null` if there is no attribute by that name.
  `Map<String,Object>`
  `getAttributeMap()`
  Return the attribute map.
  `Enumeration<String>`
  `getAttributeNames()`
  Returns an `Enumeration` containing the attribute names available within this servlet context.
  `protected ServletContext`
  `getFacade()`
  Returns the ServletContext facade.
  `protected ReplicatedContext`
  `getParent()`
  Return the parent replicated context.
  `void`
  `removeAttribute(String name)`
  Removes the attribute with the given name from the servlet context.
  `void`
  `setAttribute(String name, Object value)`
  Binds an object to a given attribute name in this servlet context.
  `void`
  `setAttributeMap(Map<String,Object> map)`
  Set the attribute map.

  ### Methods inherited from class ApplicationContext

  `addFilter, addFilter, addFilter, addJspFile, addListener, addListener, addListener, addServlet, addServlet, addServlet, clearAttributes, createFilter, createListener, createServlet, declareRoles, getClassLoader, getContext, getContext, getContextPath, getDefaultSessionTrackingModes, getEffectiveMajorVersion, getEffectiveMinorVersion, getEffectiveSessionTrackingModes, getFilterRegistration, getFilterRegistrations, getInitParameter, getInitParameterNames, getJspConfigDescriptor, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getRealPath, getRequestCharacterEncoding, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getResponseCharacterEncoding, getServerInfo, getServlet, getServletContextName, getServletNames, getServletRegistration, getServletRegistrations, getServlets, getSessionCookieConfig, getSessionTimeout, getVirtualServerName, log, log, log, setInitParameter, setNewServletContextListenerAllowed, setRequestCharacterEncoding, setResponseCharacterEncoding, setSessionTimeout, setSessionTrackingModes`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### tomcatAttributes

    protected final Map<String,Object> tomcatAttributes
    Map for Tomcat-specific attributes that should not be replicated.

- ## Constructor Details

  - ### ReplApplContext

    public ReplApplContext(ReplicatedContext context)
    Create a new instance.
    Parameters:
      `context` - the replicated context

- ## Method Details

  - ### getParent

    protected ReplicatedContext getParent()
    Return the parent replicated context.
    Returns:
      the parent context

  - ### getFacade

    protected ServletContext getFacade()
    Description copied from class: `ApplicationContext`
    Returns the ServletContext facade.
    Overrides:
      `getFacade` in class `ApplicationContext`
    Returns:
      the facade associated with this ApplicationContext.

  - ### getAttributeMap

    public Map<String,Object> getAttributeMap()
    Return the attribute map.
    Returns:
      the attribute map

  - ### setAttributeMap

    public void setAttributeMap(Map<String,Object> map)
    Set the attribute map.
    Parameters:
      `map` - the new attribute map

  - ### removeAttribute

    public void removeAttribute(String name)
    Description copied from interface: `javax.servlet.ServletContext`
    Removes the attribute with the given name from the servlet context. After removal, subsequent calls to `ServletContext.getAttribute(String)` to retrieve the attribute's value will return `null`.

    If listeners are configured on the `ServletContext` the container notifies them accordingly.

    Specified by:
      `removeAttribute` in interface `ServletContext`
    Overrides:
      `removeAttribute` in class `ApplicationContext`
    Parameters:
      `name` - a `String` specifying the name of the attribute to be removed

  - ### setAttribute

    public void setAttribute(String name, Object value)
    Description copied from interface: `javax.servlet.ServletContext`
    Binds an object to a given attribute name in this servlet context. If the name specified is already used for an attribute, this method will replace the attribute with the new to the new attribute.

    If listeners are configured on the `ServletContext` the container notifies them accordingly.

    If a null value is passed, the effect is the same as calling `removeAttribute()`.

    Attribute names should follow the same convention as package names. The Java Servlet API specification reserves names matching `java.*`, `javax.*`, and `sun.*`.

    Specified by:
      `setAttribute` in interface `ServletContext`
    Overrides:
      `setAttribute` in class `ApplicationContext`
    Parameters:
      `name` - a `String` specifying the name of the attribute
      `value` - an `Object` representing the attribute to be bound

  - ### getAttribute

    public Object getAttribute(String name)
    Description copied from interface: `javax.servlet.ServletContext`
    Returns the servlet container attribute with the given name, or `null` if there is no attribute by that name. An attribute allows a servlet container to give the servlet additional information not already provided by this interface. See your server documentation for information about its attributes. A list of supported attributes can be retrieved using `getAttributeNames`.

    The attribute is returned as a `java.lang.Object` or some subclass. Attribute names should follow the same convention as package names. The Java Servlet API specification reserves names matching `java.*`, `javax.*`, and `sun.*`.

    Specified by:
      `getAttribute` in interface `ServletContext`
    Overrides:
      `getAttribute` in class `ApplicationContext`
    Parameters:
      `name` - a `String` specifying the name of the attribute
    Returns:
      an `Object` containing the value of the attribute, or `null` if no attribute exists matching the given name
    See Also:
      - `ServletContext.getAttributeNames()`

  - ### getAttributeNames

    public Enumeration<String> getAttributeNames()
    Description copied from interface: `javax.servlet.ServletContext`
    Returns an `Enumeration` containing the attribute names available within this servlet context. Use the `ServletContext.getAttribute(String)` method with an attribute name to get the value of an attribute.
    Specified by:
      `getAttributeNames` in interface `ServletContext`
    Overrides:
      `getAttributeNames` in class `ApplicationContext`
    Returns:
      an `Enumeration` of attribute names
    See Also:
      - `ServletContext.getAttribute(String)`