AbstractAccessLogValve.PortElement (Apache Tomcat 11.0.22 API Documentation)
Description: declaration: package: org.apache.catalina.valves, class: AbstractAccessLogValve, class: PortElement

# Class AbstractAccessLogValve.PortElement

java.lang.Object
org.apache.catalina.valves.AbstractAccessLogValve.PortElement

All Implemented Interfaces:
  `AbstractAccessLogValve.AccessLogElement, AbstractAccessLogValve.CachedElement`

Enclosing class:
  `AbstractAccessLogValve`

protected class AbstractAccessLogValve.PortElement extends Object implements AbstractAccessLogValve.AccessLogElement, AbstractAccessLogValve.CachedElement
Write local or remote port for request connection - %p and %{xxx}p.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PortElement()`
  Creates a new port element using local port type.
  `PortElement(String type)`
  Creates a new port element with the specified type.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addElement(CharArrayWriter buf, Request request, Response response, long time)`
  Called to create an access log entry.
  `void`
  `cache(Request request)`
  Cache the value for the specified request.

  ### Methods inherited from class Object

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

  ### Methods inherited from interface AbstractAccessLogValve.AccessLogElement

  `addElement`

- ## Constructor Details

  - ### PortElement

    public PortElement()
    Creates a new port element using local port type.

  - ### PortElement

    public PortElement(String type)
    Creates a new port element with the specified type.
    Parameters:
      `type` - The port type ("local" or "remote")

- ## Method Details

  - ### addElement

    public void addElement(CharArrayWriter buf, Request request, Response response, long time)
    Description copied from interface: `AbstractAccessLogValve.AccessLogElement`
    Called to create an access log entry.
    Specified by:
      `addElement` in interface `AbstractAccessLogValve.AccessLogElement`
    Parameters:
      `buf` - The buffer to which the log element should be added
      `request` - The request that triggered this access log entry
      `response` - The response to the request that triggered this access log entry
      `time` - The time taken in nanoseconds to process the request

  - ### cache

    public void cache(Request request)
    Description copied from interface: `AbstractAccessLogValve.CachedElement`
    Cache the value for the specified request.
    Specified by:
      `cache` in interface `AbstractAccessLogValve.CachedElement`
    Parameters:
      `request` - The request to cache the value for