You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/04/08 08:43:58 UTC
[tomcat] branch 9.0.x updated: Add an extra field to keep around
the configured protocol
This is an automated email from the ASF dual-hosted git repository.
remm 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 5e0dd5d Add an extra field to keep around the configured protocol
5e0dd5d is described below
commit 5e0dd5d91ca3b9eb85d79fca2b9ce9313d90083c
Author: remm <re...@apache.org>
AuthorDate: Wed Apr 8 10:43:46 2020 +0200
Add an extra field to keep around the configured protocol
This is simpler and more accurate that converting it back from the class
name.
---
java/org/apache/catalina/connector/Connector.java | 10 +++++++++-
java/org/apache/coyote/ProtocolHandler.java | 17 -----------------
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index f30f26e..eefb6aa 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -79,6 +79,7 @@ public class Connector extends LifecycleMBeanBase {
public Connector(String protocol) {
+ configuredProtocol = protocol;
boolean apr = AprLifecycleListener.isAprAvailable() &&
AprLifecycleListener.getUseAprConnector();
ProtocolHandler p = null;
@@ -102,6 +103,7 @@ public class Connector extends LifecycleMBeanBase {
public Connector(ProtocolHandler protocolHandler) {
protocolHandlerClassName = protocolHandler.getClass().getName();
+ configuredProtocol = protocolHandlerClassName;
this.protocolHandler = protocolHandler;
// Default for Connector depends on this system property
setThrowOnFailure(Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"));
@@ -247,6 +249,12 @@ public class Connector extends LifecycleMBeanBase {
/**
+ * Name of the protocol that was configured.
+ */
+ protected final String configuredProtocol;
+
+
+ /**
* Coyote protocol handler.
*/
protected final ProtocolHandler protocolHandler;
@@ -608,7 +616,7 @@ public class Connector extends LifecycleMBeanBase {
* @return the Coyote protocol handler in use.
*/
public String getProtocol() {
- return ProtocolHandler.getProtocol(getProtocolHandlerClassName(), AprLifecycleListener.getUseAprConnector());
+ return configuredProtocol;
}
diff --git a/java/org/apache/coyote/ProtocolHandler.java b/java/org/apache/coyote/ProtocolHandler.java
index acdf202..34bd47f 100644
--- a/java/org/apache/coyote/ProtocolHandler.java
+++ b/java/org/apache/coyote/ProtocolHandler.java
@@ -233,21 +233,4 @@ public interface ProtocolHandler {
}
- /**
- * Get the protocol name associated with the protocol class.
- * @param protocolClassName the protocol class name
- * @param apr if <code>true</code> the APR protcol handler will be used
- * @return the protocol name
- */
- public static String getProtocol(String protocolClassName, boolean apr) {
- if ((!apr && org.apache.coyote.http11.Http11NioProtocol.class.getName().equals(protocolClassName))
- || (apr && org.apache.coyote.http11.Http11AprProtocol.class.getName().equals(protocolClassName))) {
- return "HTTP/1.1";
- } else if ((!apr && org.apache.coyote.ajp.AjpNioProtocol.class.getName().equals(protocolClassName))
- || (apr && org.apache.coyote.ajp.AjpAprProtocol.class.getName().equals(protocolClassName))) {
- return "AJP/1.3";
- }
- return protocolClassName;
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org