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:37:33 UTC
[tomcat] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 8cdd497 Add an extra field to keep around the configured protocol
8cdd497 is described below
commit 8cdd49767214d68721c34cdaf838b4164fd62ead
Author: remm <re...@apache.org>
AuthorDate: Wed Apr 8 10:37:16 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 | 14 --------------
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index f529161..2a56d16 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -73,6 +73,7 @@ public class Connector extends LifecycleMBeanBase {
public Connector(String protocol) {
+ configuredProtocol = protocol;
ProtocolHandler p = null;
try {
p = ProtocolHandler.create(protocol);
@@ -94,6 +95,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"));
@@ -259,6 +261,12 @@ public class Connector extends LifecycleMBeanBase {
/**
+ * Name of the protocol that was configured.
+ */
+ protected final String configuredProtocol;
+
+
+ /**
* Coyote protocol handler.
*/
protected final ProtocolHandler protocolHandler;
@@ -651,7 +659,7 @@ public class Connector extends LifecycleMBeanBase {
* @return the Coyote protocol handler in use.
*/
public String getProtocol() {
- return ProtocolHandler.getProtocol(getProtocolHandlerClassName());
+ return configuredProtocol;
}
diff --git a/java/org/apache/coyote/ProtocolHandler.java b/java/org/apache/coyote/ProtocolHandler.java
index 902e86e..c6e1565 100644
--- a/java/org/apache/coyote/ProtocolHandler.java
+++ b/java/org/apache/coyote/ProtocolHandler.java
@@ -222,18 +222,4 @@ public interface ProtocolHandler {
}
- /**
- * Get the protocol name associated with the protocol class.
- * @param protocolClassName the protocol class name
- * @return the protocol name
- */
- public static String getProtocol(String protocolClassName) {
- if (org.apache.coyote.http11.Http11NioProtocol.class.getName().equals(protocolClassName)) {
- return "HTTP/1.1";
- } else if (org.apache.coyote.ajp.AjpNioProtocol.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