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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new f480a039f8 Log info message if APR Connector is used - recommends NIO 
instead
f480a039f8 is described below

commit f480a039f868c27599f95db574581647238442f5
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Feb 11 17:00:28 2026 +0000

    Log info message if APR Connector is used - recommends NIO instead
---
 java/org/apache/coyote/ajp/AjpAprProtocol.java     | 19 ++++++++++++-----
 java/org/apache/coyote/ajp/LocalStrings.properties |  2 ++
 .../apache/coyote/http11/Http11AprProtocol.java    | 24 +++++++++++++++++++++-
 .../apache/coyote/http11/LocalStrings.properties   |  3 +++
 webapps/docs/changelog.xml                         |  4 ++++
 5 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AjpAprProtocol.java 
b/java/org/apache/coyote/ajp/AjpAprProtocol.java
index 7d30f9affe..3982da22a3 100644
--- a/java/org/apache/coyote/ajp/AjpAprProtocol.java
+++ b/java/org/apache/coyote/ajp/AjpAprProtocol.java
@@ -32,12 +32,14 @@ public class AjpAprProtocol extends 
AbstractAjpProtocol<Long> {
 
     private static final Log log = LogFactory.getLog(AjpAprProtocol.class);
 
+    @Deprecated
     @Override
     protected Log getLog() {
         return log;
     }
 
 
+    @Deprecated
     @Override
     public boolean isAprRequired() {
         // Override since this protocol implementation requires the APR/native
@@ -46,26 +48,33 @@ public class AjpAprProtocol extends 
AbstractAjpProtocol<Long> {
     }
 
 
-    // ------------------------------------------------------------ Constructor
-
+    @Deprecated
     public AjpAprProtocol() {
         super(new AprEndpoint());
     }
 
 
-    // --------------------------------------------------------- Public Methods
-
+    @Deprecated
     public int getPollTime() {
         return ((AprEndpoint) getEndpoint()).getPollTime();
     }
 
+    @Deprecated
     public void setPollTime(int pollTime) {
         ((AprEndpoint) getEndpoint()).setPollTime(pollTime);
     }
 
 
-    // ----------------------------------------------------- JMX related 
methods
+    @Deprecated
+    @Override
+    public void init() throws Exception {
+        super.init();
+
+        log.info(sm.getString("ajpAprProtocol.deprecated", getName()));
+    }
+
 
+    @Deprecated
     @Override
     protected String getNamePrefix() {
         return "ajp-apr";
diff --git a/java/org/apache/coyote/ajp/LocalStrings.properties 
b/java/org/apache/coyote/ajp/LocalStrings.properties
index f9de35dd4b..6fbef0dfb5 100644
--- a/java/org/apache/coyote/ajp/LocalStrings.properties
+++ b/java/org/apache/coyote/ajp/LocalStrings.properties
@@ -16,6 +16,8 @@
 # Do not edit this file directly.
 # To edit translations see: 
https://tomcat.apache.org/getinvolved.html#Translations
 
+ajpAprProtocol.deprecated=The AJP APR Connector is deprecated. It is strongly 
recommended that the [{0}] Connector configuration is modified to use NIO with 
AJP instead.
+
 ajpMessage.invalidPos=Requested read of bytes at position [{0}] which is 
beyond the end of the AJP message
 
 ajpmessage.invalid=Invalid message received with signature [{0}]
diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java 
b/java/org/apache/coyote/http11/Http11AprProtocol.java
index 31895622e3..d5a7b20123 100644
--- a/java/org/apache/coyote/http11/Http11AprProtocol.java
+++ b/java/org/apache/coyote/http11/Http11AprProtocol.java
@@ -32,21 +32,25 @@ public class Http11AprProtocol extends 
AbstractHttp11Protocol<Long> {
 
     private static final Log log = LogFactory.getLog(Http11AprProtocol.class);
 
+    @Deprecated
     public Http11AprProtocol() {
         this(new AprEndpoint());
     }
 
 
+    @Deprecated
     public Http11AprProtocol(AprEndpoint endpoint) {
         super(endpoint);
     }
 
 
+    @Deprecated
     @Override
     protected Log getLog() {
         return log;
     }
 
+    @Deprecated
     @Override
     public boolean isAprRequired() {
         // Override since this protocol implementation requires the APR/native
@@ -54,33 +58,51 @@ public class Http11AprProtocol extends 
AbstractHttp11Protocol<Long> {
         return true;
     }
 
+    @Deprecated
     public int getPollTime() {
         return ((AprEndpoint) getEndpoint()).getPollTime();
     }
 
+    @Deprecated
     public void setPollTime(int pollTime) {
         ((AprEndpoint) getEndpoint()).setPollTime(pollTime);
     }
 
+    @Deprecated
     public int getSendfileSize() {
         return ((AprEndpoint) getEndpoint()).getSendfileSize();
     }
 
+    @Deprecated
     public void setSendfileSize(int sendfileSize) {
         ((AprEndpoint) getEndpoint()).setSendfileSize(sendfileSize);
     }
 
+    @Deprecated
     public boolean getDeferAccept() {
         return ((AprEndpoint) getEndpoint()).getDeferAccept();
     }
 
+    @Deprecated
     public void setDeferAccept(boolean deferAccept) {
         ((AprEndpoint) getEndpoint()).setDeferAccept(deferAccept);
     }
 
 
-    // ----------------------------------------------------- JMX related 
methods
 
+    @Override
+    public void init() throws Exception {
+        super.init();
+
+        if (isSSLEnabled()) {
+            log.info(sm.getString("ajpHttpsProtocol.deprecated", getName()));
+        } else {
+            log.info(sm.getString("ajpHttpProtocol.deprecated", getName()));
+        }
+    }
+
+
+    @Deprecated
     @Override
     protected String getNamePrefix() {
         if (isSSLEnabled()) {
diff --git a/java/org/apache/coyote/http11/LocalStrings.properties 
b/java/org/apache/coyote/http11/LocalStrings.properties
index 7d9fe90f1f..2b260aba2e 100644
--- a/java/org/apache/coyote/http11/LocalStrings.properties
+++ b/java/org/apache/coyote/http11/LocalStrings.properties
@@ -22,6 +22,9 @@ abstractHttp11Protocol.httpUpgradeConfigured=The [{0}] 
connector has been config
 abstractHttp11Protocol.upgradeJmxNameFail=Failed to create ObjectName with 
which to register upgrade protocol in JMX
 abstractHttp11Protocol.upgradeJmxRegistrationFail=Failed to register upgrade 
protocol in JMX
 
+ajpHttpProtocol.deprecated=The HTTP APR Connector is deprecated. It is 
strongly recommended that the [{0}] Connector configuration is modified to use 
NIO with HTTP instead.
+ajpHttpsProtocol.deprecated=The HTTPS APR Connector is deprecated. It is 
strongly recommended that the [{0}] Connector configuration is modified to use 
NIO+JSSE or NIO+OpenSSL (with Tomcat Native 2.0.x) instead.
+
 http11processor.fallToDebug=\n\
 \ Note: further occurrences of HTTP request parsing errors will be logged at 
DEBUG level.
 http11processor.header.parse=Error parsing HTTP request header
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 55750f05cd..0308d306fd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -143,6 +143,10 @@
         when closing am HTTP/2 connection. Pull request <pr>917</pr> provided 
by
         Kai Burjack. (markt)
       </add>
+      <add>
+        Log an information message if an APR Connector is used, recommending
+        that the appropriate NIO Connector is used instead. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to