This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 61f2d73160 Add javadoc
61f2d73160 is described below

commit 61f2d7316049a3d86d087c9cdd0d7be3ab5d2a65
Author: remm <[email protected]>
AuthorDate: Thu Apr 2 15:10:58 2026 +0200

    Add javadoc
---
 .../catalina/valves/AbstractAccessLogValve.java    | 413 +++++++++++++++++++--
 1 file changed, 375 insertions(+), 38 deletions(-)

diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index 65c2718efd..8991337209 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -134,10 +134,25 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      * The list of our time format types.
      */
     private enum FormatType {
+        /**
+         * Common Log Format.
+         */
         CLF,
+        /**
+         * Seconds since epoch.
+         */
         SEC,
+        /**
+         * Milliseconds since epoch.
+         */
         MSEC,
+        /**
+         * Millisecond fraction of timestamp.
+         */
         MSEC_FRAC,
+        /**
+         * SimpleDateFormat format.
+         */
         SDF
     }
 
@@ -145,7 +160,13 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      * The list of our port types.
      */
     private enum PortType {
+        /**
+         * Local port.
+         */
         LOCAL,
+        /**
+         * Remote port.
+         */
         REMOTE
     }
 
@@ -153,16 +174,34 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      * The list of our ip address types.
      */
     private enum RemoteAddressType {
+        /**
+         * Remote address.
+         */
         REMOTE,
+        /**
+         * Peer address.
+         */
         PEER
     }
 
+    /**
+     * The list of identifier types.
+     */
     private enum IdentifierType {
+        /**
+         * Connection identifier.
+         */
         CONNECTION,
+        /**
+         * Unknown identifier.
+         */
         UNKNOWN
     }
 
 
+    /**
+     * Default constructor.
+     */
     public AbstractAccessLogValve() {
         super(true);
     }
@@ -226,6 +265,9 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      */
     protected static class DateFormatCache {
 
+        /**
+         * Cache for formatted timestamps.
+         */
         protected class Cache {
 
             /* CLF log format */
@@ -251,14 +293,32 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 
             private final Cache parent;
 
+            /**
+             * Creates a new cache with the given parent cache.
+             *
+             * @param parent The parent cache
+             */
             private Cache(Cache parent) {
                 this(null, parent);
             }
 
+            /**
+             * Creates a new cache with the given format and parent cache.
+             *
+             * @param format The format string
+             * @param parent The parent cache
+             */
             private Cache(String format, Cache parent) {
                 this(format, null, parent);
             }
 
+            /**
+             * Creates a new cache with the given format, locale and parent 
cache.
+             *
+             * @param format The format string
+             * @param loc The locale
+             * @param parent The parent cache
+             */
             private Cache(String format, Locale loc, Cache parent) {
                 cache = new String[cacheSize];
                 for (int i = 0; i < cacheSize; i++) {
@@ -278,6 +338,13 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
                 this.parent = parent;
             }
 
+            /**
+             * Gets the formatted timestamp for the given time.
+             *
+             * @param time The time in milliseconds
+             *
+             * @return The formatted timestamp
+             */
             private String getFormatInternal(long time) {
 
                 long seconds = time / 1000;
@@ -355,6 +422,13 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
         protected final Cache cLFCache;
         private final Map<String,Cache> formatCache = new HashMap<>();
 
+        /**
+         * Creates a new date format cache.
+         *
+         * @param size The cache size
+         * @param loc The default locale
+         * @param parentFC The parent cache
+         */
         protected DateFormatCache(int size, Locale loc, DateFormatCache 
parentFC) {
             cacheSize = size;
             cacheDefaultLocale = loc;
@@ -368,6 +442,14 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
             cLFCache = new Cache(parentCache);
         }
 
+        /**
+         * Gets the cache for the given format.
+         *
+         * @param format The format string
+         * @param loc The locale
+         *
+         * @return The cache
+         */
         private Cache getCache(String format, Locale loc) {
             Cache cache;
             if (format == null) {
@@ -388,10 +470,26 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
             return cache;
         }
 
+        /**
+         * Gets the formatted timestamp in CLF format.
+         *
+         * @param time The time in milliseconds
+         *
+         * @return The formatted timestamp
+         */
         public String getFormat(long time) {
             return cLFCache.getFormatInternal(time);
         }
 
+        /**
+         * Gets the formatted timestamp in the given format.
+         *
+         * @param format The format string
+         * @param loc The locale
+         * @param time The time in milliseconds
+         *
+         * @return The formatted timestamp
+         */
         public String getFormat(String format, Locale loc, long time) {
             return getCache(format, loc).getFormatInternal(time);
         }
@@ -422,6 +520,7 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 
     /**
      * Are we doing conditional logging ? default null. It is the value of 
<code>conditionIf</code> property.
+     * If the ServletRequest.getAttribute(conditionIf) yields a non-null 
value, the logging will be performed.
      */
     protected String conditionIf = null;
 
@@ -778,13 +877,26 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      * cache the value in the element since the elements are state-less.
      */
     protected interface CachedElement {
+        /**
+         * Cache the value for the specified request.
+         *
+         * @param request The request to cache the value for
+         */
         void cache(Request request);
     }
 
     /**
-     * write thread name - %I
+     * Write thread name - %I.
      */
     protected static class ThreadNameElement implements AccessLogElement {
+        /**
+         * Adds the thread name element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             RequestInfo info = 
request.getCoyoteRequest().getRequestProcessor();
@@ -797,12 +909,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write local IP address - %A
+     * Write local IP address - %A.
      */
     protected static class LocalAddrElement implements AccessLogElement {
 
         private final String localAddrValue;
 
+        /**
+         * Creates a new local address element.
+         *
+         * @param ipv6Canonical Whether to use IPv6 canonical representation
+         */
         public LocalAddrElement(boolean ipv6Canonical) {
             String init;
             try {
@@ -826,21 +943,29 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write remote IP address - %a
+     * Write remote IP address - %a.
      */
     protected class RemoteAddrElement implements AccessLogElement, 
CachedElement {
         /**
-         * Type of address to log
+         * Type of address to log.
          */
         private static final String remoteAddress = "remote";
         private static final String peerAddress = "peer";
 
         private final RemoteAddressType remoteAddressType;
 
+        /**
+         * Creates a new remote address element using remote address type.
+         */
         public RemoteAddrElement() {
             remoteAddressType = RemoteAddressType.REMOTE;
         }
 
+        /**
+         * Creates a new remote address element with the specified type.
+         *
+         * @param type The address type ("remote" or "peer")
+         */
         public RemoteAddrElement(String type) {
             switch (type) {
                 case remoteAddress:
@@ -893,9 +1018,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write remote host name - %h
+     * Write remote host name - %h.
      */
     protected class HostElement implements AccessLogElement, CachedElement {
+        /**
+         * Adds the host element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             String value = null;
@@ -927,9 +1060,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write remote logical username from identd (always returns '-') - %l
+     * Write remote logical username from identd (always returns '-') - %l.
      */
     protected static class LogicalUserNameElement implements AccessLogElement {
+        /**
+         * Adds the logical user name element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             buf.append('-');
@@ -937,9 +1078,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write request protocol - %H
+     * Write request protocol - %H.
      */
     protected class ProtocolElement implements AccessLogElement {
+        /**
+         * Adds the protocol element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (requestAttributesEnabled) {
@@ -956,9 +1105,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write remote user that was authenticated (if any), else '-' - %u
+     * Write remote user that was authenticated (if any), else '-' - %u.
      */
     protected static class UserElement implements AccessLogElement {
+        /**
+         * Adds the user element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (request != null) {
@@ -970,42 +1127,42 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write date and time, in configurable format (default CLF) - %t or 
%{format}t
+     * Write date and time, in configurable format (default CLF) - %t or 
%{format}t.
      */
     protected class DateAndTimeElement implements AccessLogElement {
 
         /**
-         * Format prefix specifying request start time
+         * Format prefix specifying request start time.
          */
         private static final String requestStartPrefix = "begin";
 
         /**
-         * Format prefix specifying response end time
+         * Format prefix specifying response end time.
          */
         private static final String responseEndPrefix = "end";
 
         /**
-         * Separator between optional prefix and rest of format
+         * Separator between optional prefix and rest of format.
          */
         private static final String prefixSeparator = ":";
 
         /**
-         * Special format for seconds since epoch
+         * Special format for seconds since epoch.
          */
         private static final String secFormat = "sec";
 
         /**
-         * Special format for milliseconds since epoch
+         * Special format for milliseconds since epoch.
          */
         private static final String msecFormat = "msec";
 
         /**
-         * Special format for millisecond part of timestamp
+         * Special format for millisecond part of timestamp.
          */
         private static final String msecFractionFormat = "msec_frac";
 
         /**
-         * The patterns we use to replace "S" and "SSS" millisecond formatting 
of SimpleDateFormat by our own handling
+         * The patterns we use to replace "S" and "SSS" millisecond formatting 
of SimpleDateFormat by our own handling.
          */
         private static final String msecPattern = "{#}";
         private static final String tripleMsecPattern = msecPattern + 
msecPattern + msecPattern;
@@ -1021,6 +1178,9 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
         /* Whether we need to postprocess by adding milliseconds */
         private boolean usesMsecs = false;
 
+        /**
+         * Creates a new date and time element using CLF format.
+         */
         protected DateAndTimeElement() {
             this(null);
         }
@@ -1029,6 +1189,10 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
          * Replace the millisecond formatting character 'S' by some dummy 
characters in order to make the resulting
          * formatted time stamps cacheable. We replace the dummy chars later 
with the actual milliseconds because that's
          * relatively cheap.
+         *
+         * @param format The format string
+         *
+         * @return The tidied format string
          */
         private String tidyFormat(String format) {
             boolean escape = false;
@@ -1050,6 +1214,11 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
             return result.toString();
         }
 
+        /**
+         * Creates a new date and time element with the specified format.
+         *
+         * @param sdf The SimpleDateFormat pattern or special format identifier
+         */
         protected DateAndTimeElement(String sdf) {
             String format = sdf;
             boolean needsEscaping = false;
@@ -1155,9 +1324,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write first line of the request (method and request URI) - %r
+     * Write first line of the request (method and request URI) - %r.
      */
     protected static class RequestElement implements AccessLogElement {
+        /**
+         * Adds the request element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (request != null) {
@@ -1187,9 +1364,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write HTTP status code of the response - %s
+     * Write HTTP status code of the response - %s.
      */
     protected static class HttpStatusCodeElement implements AccessLogElement {
+        /**
+         * Adds the HTTP status code element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (response != null) {
@@ -1208,7 +1393,7 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write local or remote port for request connection - %p and %{xxx}p
+     * Write local or remote port for request connection - %p and %{xxx}p.
      */
     protected class PortElement implements AccessLogElement, CachedElement {
 
@@ -1220,10 +1405,18 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 
         private final PortType portType;
 
+        /**
+         * Creates a new port element using local port type.
+         */
         public PortElement() {
             portType = PortType.LOCAL;
         }
 
+        /**
+         * Creates a new port element with the specified type.
+         *
+         * @param type The port type ("local" or "remote")
+         */
         public PortElement(String type) {
             switch (type) {
                 case remotePort:
@@ -1266,18 +1459,28 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write bytes sent, excluding HTTP headers - %b, %B
+     * Write bytes sent, excluding HTTP headers - %b, %B.
      */
     protected static class ByteSentElement implements AccessLogElement {
         private final boolean conversion;
 
         /**
+         * Creates a new ByteSentElement.
+         *
          * @param conversion <code>true</code> to write '-' instead of 0 - %b.
          */
         public ByteSentElement(boolean conversion) {
             this.conversion = conversion;
         }
 
+        /**
+         * Adds the byte sent element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             // Don't need to flush since trigger for log message is after the
@@ -1303,9 +1506,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write request method (GET, POST, etc.) - %m
+     * Write request method (GET, POST, etc.) - %m.
      */
     protected static class MethodElement implements AccessLogElement {
+        /**
+         * Adds the method element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (request != null) {
@@ -1315,16 +1526,25 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write time taken to process the request - %D, %T
+     * Write time taken to process the request - %D, %T.
      */
     protected static class ElapsedTimeElement implements AccessLogElement {
+        /**
+         * Style for formatting elapsed time.
+         */
         public enum Style {
+            /**
+             * Seconds format.
+             */
             SECONDS {
                 @Override
                 public void append(CharArrayWriter buf, long time) {
                     
buf.append(Long.toString(TimeUnit.NANOSECONDS.toSeconds(time)));
                 }
             },
+            /**
+             * Fractional seconds format.
+             */
             SECONDS_FRACTIONAL {
                 @Override
                 public void append(CharArrayWriter buf, long time) {
@@ -1338,18 +1558,27 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
                     buf.append(Long.toString(remains % 10));
                 }
             },
+            /**
+             * Milliseconds format.
+             */
             MILLISECONDS {
                 @Override
                 public void append(CharArrayWriter buf, long time) {
                     
buf.append(Long.toString(TimeUnit.NANOSECONDS.toMillis(time)));
                 }
             },
+            /**
+             * Microseconds format.
+             */
             MICROSECONDS {
                 @Override
                 public void append(CharArrayWriter buf, long time) {
                     
buf.append(Long.toString(TimeUnit.NANOSECONDS.toMicros(time)));
                 }
             },
+            /**
+             * Nanoseconds format.
+             */
             NANOSECONDS {
                 @Override
                 public void append(CharArrayWriter buf, long time) {
@@ -1378,6 +1607,8 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
         }
 
         /**
+         * Creates a new ElapsedTimeElement that will log the time in the 
specified style.
+         *
          * @param micros <code>true</code>, write time in microseconds - %D
          * @param millis <code>true</code>, write time in milliseconds, if 
both arguments are <code>false</code>, write
          *                   time in seconds - %T
@@ -1393,9 +1624,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write time until first byte is written (commit time) in millis - %F
+     * Write time until first byte is written (commit time) in millis - %F.
      */
     protected static class FirstByteTimeElement implements AccessLogElement {
+        /**
+         * Adds the first byte time element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             long commitTime = 
response.getCoyoteResponse().getCommitTimeNanos();
@@ -1409,9 +1648,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write Query string (prepended with a '?' if it exists) - %q
+     * Write query string (prepended with a '?' if it exists) - %q.
      */
     protected static class QueryElement implements AccessLogElement {
+        /**
+         * Adds the query element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             String query = null;
@@ -1431,9 +1678,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write user session ID - %S
+     * Write user session ID - %S.
      */
     protected static class SessionIdElement implements AccessLogElement {
+        /**
+         * Adds the session ID element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (request == null) {
@@ -1450,9 +1705,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write requested URL path - %U
+     * Write requested URL path - %U.
      */
     protected static class RequestURIElement implements AccessLogElement {
+        /**
+         * Adds the request URI element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (request != null) {
@@ -1464,9 +1727,17 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write local server name - %v
+     * Write local server name - %v.
      */
     protected class LocalServerNameElement implements AccessLogElement {
+        /**
+         * Adds the local server name element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             String value = null;
@@ -1491,11 +1762,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write any string
+     * Write any constant string.
      */
     protected static class StringElement implements AccessLogElement {
         private final String str;
 
+        /**
+         * Creates a new string element.
+         *
+         * @param str The string to write
+         */
         public StringElement(String str) {
             this.str = str;
         }
@@ -1507,11 +1783,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write incoming headers - %{xxx}i
+     * Write incoming headers - %{xxx}i.
      */
     protected static class HeaderElement implements AccessLogElement {
         private final String header;
 
+        /**
+         * Creates a new header element.
+         *
+         * @param header The header name
+         */
         public HeaderElement(String header) {
             this.header = header;
         }
@@ -1532,11 +1813,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write a specific cookie - %{xxx}c
+     * Write a specific cookie - %{xxx}c.
      */
     protected static class CookieElement implements AccessLogElement {
         private final String cookieNameToLog;
 
+        /**
+         * Creates a new cookie element.
+         *
+         * @param cookieNameToLog The cookie name to log
+         */
         public CookieElement(String cookieNameToLog) {
             this.cookieNameToLog = cookieNameToLog;
         }
@@ -1570,11 +1856,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write a specific response header - %{xxx}o
+     * Write a specific response header - %{xxx}o.
      */
     protected static class ResponseHeaderElement implements AccessLogElement {
         private final String header;
 
+        /**
+         * Creates a new response header element.
+         *
+         * @param header The header name
+         */
         public ResponseHeaderElement(String header) {
             this.header = header;
         }
@@ -1597,11 +1888,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write an attribute in the ServletRequest - %{xxx}r
+     * Write an attribute in the ServletRequest - %{xxx}r.
      */
     protected static class RequestAttributeElement implements AccessLogElement 
{
         private final String attribute;
 
+        /**
+         * Creates a new request attribute element.
+         *
+         * @param attribute The attribute name
+         */
         public RequestAttributeElement(String attribute) {
             this.attribute = attribute;
         }
@@ -1627,11 +1923,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
     /**
-     * write an attribute in the HttpSession - %{xxx}s
+     * Write an attribute in the HttpSession - %{xxx}s.
      */
     protected static class SessionAttributeElement implements AccessLogElement 
{
         private final String attribute;
 
+        /**
+         * Creates a new session attribute element.
+         *
+         * @param attribute The attribute name
+         */
         public SessionAttributeElement(String attribute) {
             this.attribute = attribute;
         }
@@ -1659,10 +1960,18 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
         }
     }
 
-    /**
-     * Write connection status when response is completed - %X
+/**
+     * Write connection status when response is completed - %X.
      */
     protected static class ConnectionStatusElement implements AccessLogElement 
{
+        /**
+         * Adds the connection status element to the buffer.
+         *
+         * @param buf      The buffer to which the log element should be added
+         * @param request  The request that triggered this access log entry
+         * @param response The response to the request that triggered this 
access log entry
+         * @param time     The time taken in nanoseconds to process the request
+         */
         @Override
         public void addElement(CharArrayWriter buf, Request request, Response 
response, long time) {
             if (response != null && request != null) {
@@ -1703,20 +2012,27 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 
 
     /**
-     * Write identifier element %{xxx}L
+     * Write identifier element %{xxx}L.
      */
     protected static class IdentifierElement implements AccessLogElement {
 
         /**
-         * Type of identifier to log
+         * Type of identifier to log.
          */
         private final IdentifierType identifierType;
 
+        /**
+         * Creates a new identifier element with unknown type.
+         */
         public IdentifierElement() {
             this("");
         }
 
-
+        /**
+         * Creates a new identifier element with the specified type.
+         *
+         * @param type The identifier type ("c" for connection)
+         */
         public IdentifierElement(String type) {
             switch (type) {
                 case "c":
@@ -1793,6 +2109,13 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
     }
 
 
+    /**
+     * Create an array of cached elements from the given access log elements.
+     *
+     * @param elements The access log elements
+     *
+     * @return the cached elements array
+     */
     private CachedElement[] createCachedElements(AccessLogElement[] elements) {
         List<CachedElement> list = new ArrayList<>();
         for (AccessLogElement element : elements) {
@@ -1941,10 +2264,24 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
      * Reviewing the httpd code, characters with the high bit set are escaped. 
The httpd is assuming a single byte
      * encoding which may not be true for Tomcat so Tomcat uses the Java 
\\uXXXX encoding.
      */
+    /**
+     * Escapes and appends the input string to the destination writer.
+     *
+     * @param input The input string
+     * @param dest  The destination writer
+     */
     protected static void escapeAndAppend(String input, CharArrayWriter dest) {
         escapeAndAppend(input, dest, false);
     }
 
+
+    /**
+     * Escapes and appends the input string to the destination writer.
+     *
+     * @param input                The input string
+     * @param dest                 The destination writer
+     * @param escapeQuoteAsDouble  Whether to escape quotes as double quotes
+     */
     protected static void escapeAndAppend(String input, CharArrayWriter dest, 
boolean escapeQuoteAsDouble) {
         if (input == null || input.isEmpty()) {
             dest.append('-');


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to