[195599] Fix behavior when protocol handler class is specified as the connector protocol.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
index 4a67d9c..d849cce 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.server.tomcat.core; singleton:=true
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.1.101.qualifier
Bundle-Activator: org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
index c4877c9..dd88206 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
@@ -17,8 +17,10 @@
import java.io.FileWriter;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -57,6 +59,12 @@
protected String propertiesFile;
+ protected static final Map protocolHandlerMap = new HashMap();
+ static {
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11Protocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.jk.server.JkCoyoteHandler", "AJP/1.3");
+ }
+
/**
* Tomcat50Configuration constructor.
*
@@ -75,7 +83,7 @@
while (iterator.hasNext()) {
ServerPort port = (ServerPort) iterator.next();
// Return only an HTTP port from the selected Service
- if (port.getName().equals("HTTP") && port.getId().indexOf('/') < 0)
+ if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0)
return port;
}
return null;
@@ -114,7 +122,7 @@
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
- String name = "HTTP";
+ String name = "HTTP/1.1";
String protocol2 = "HTTP";
boolean advanced = true;
String[] contentTypes = null;
@@ -126,10 +134,32 @@
}
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
- name = protocol;
- protocol2 = protocol;
+ if (protocol.startsWith("HTTP")) {
+ name = protocol;
+ }
+ else if (protocol.startsWith("AJP")) {
+ name = protocol;
+ protocol2 = "AJP";
+ }
+ else {
+ // Get Tomcat equivalent name if protocol handler class specified
+ name = (String)protocolHandlerMap.get(protocol);
+ if (name != null) {
+ // Prepare simple protocol string for ServerPort protocol
+ int index = name.indexOf('/');
+ if (index > 0)
+ protocol2 = name.substring(0, index);
+ else
+ protocol2 = name;
+ }
+ // Specified protocol is unknown, just use as is
+ else {
+ name = protocol;
+ protocol2 = protocol;
+ }
+ }
}
- if ("HTTP".equals(protocol))
+ if (protocol2.toLowerCase().equals("http"))
contentTypes = new String[] { "web", "webservices" };
String secure = connector.getSecure();
if (secure != null && secure.length() > 0) {
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
index 02990ab..9894541 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
@@ -17,8 +17,10 @@
import java.io.FileWriter;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -56,6 +58,14 @@
protected String policyFile;
protected String propertiesFile;
+
+ protected static final Map protocolHandlerMap = new HashMap();
+ static {
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11Protocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11AprProtocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.coyote.ajp.AjpAprProtocol", "AJP/1.3");
+ protocolHandlerMap.put("org.apache.jk.server.JkCoyoteHandler", "AJP/1.3");
+ }
/**
* Tomcat55Configuration constructor.
@@ -75,7 +85,7 @@
while (iterator.hasNext()) {
ServerPort port = (ServerPort) iterator.next();
// Return only an HTTP port from the selected Service
- if (port.getName().equals("HTTP") && port.getId().indexOf('/') < 0)
+ if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0)
return port;
}
return null;
@@ -114,7 +124,7 @@
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
- String name = "HTTP";
+ String name = "HTTP/1.1";
String protocol2 = "HTTP";
boolean advanced = true;
String[] contentTypes = null;
@@ -126,10 +136,32 @@
}
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
- name = protocol;
- protocol2 = protocol;
+ if (protocol.startsWith("HTTP")) {
+ name = protocol;
+ }
+ else if (protocol.startsWith("AJP")) {
+ name = protocol;
+ protocol2 = "AJP";
+ }
+ else {
+ // Get Tomcat equivalent name if protocol handler class specified
+ name = (String)protocolHandlerMap.get(protocol);
+ if (name != null) {
+ // Prepare simple protocol string for ServerPort protocol
+ int index = name.indexOf('/');
+ if (index > 0)
+ protocol2 = name.substring(0, index);
+ else
+ protocol2 = name;
+ }
+ // Specified protocol is unknown, just use as is
+ else {
+ name = protocol;
+ protocol2 = protocol;
+ }
+ }
}
- if ("HTTP".equals(protocol))
+ if (protocol2.toLowerCase().equals("http"))
contentTypes = new String[] { "web", "webservices" };
String secure = connector.getSecure();
if (secure != null && secure.length() > 0) {
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Configuration.java
index 60808eb..5dbf0a0 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Configuration.java
@@ -17,8 +17,10 @@
import java.io.FileWriter;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -58,6 +60,15 @@
protected String propertiesFile;
+ protected static final Map protocolHandlerMap = new HashMap();
+ static {
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11Protocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11NioProtocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.coyote.http11.Http11AprProtocol", "HTTP/1.1");
+ protocolHandlerMap.put("org.apache.coyote.ajp.AjpAprProtocol", "AJP/1.3");
+ protocolHandlerMap.put("org.apache.jk.server.JkCoyoteHandler", "AJP/1.3");
+ }
+
/**
* Tomcat60Configuration constructor.
*
@@ -76,7 +87,7 @@
while (iterator.hasNext()) {
ServerPort port = (ServerPort) iterator.next();
// Return only an HTTP port from the selected Service
- if (port.getName().equals("HTTP/1.1") && port.getId().indexOf('/') < 0)
+ if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0)
return port;
}
return null;
@@ -115,7 +126,7 @@
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
- String name = "HTTP";
+ String name = "HTTP/1.1";
String protocol2 = "HTTP";
boolean advanced = true;
String[] contentTypes = null;
@@ -127,10 +138,32 @@
}
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
- name = protocol;
- protocol2 = protocol;
+ if (protocol.startsWith("HTTP")) {
+ name = protocol;
+ }
+ else if (protocol.startsWith("AJP")) {
+ name = protocol;
+ protocol2 = "AJP";
+ }
+ else {
+ // Get Tomcat equivalent name if protocol handler class specified
+ name = (String)protocolHandlerMap.get(protocol);
+ if (name != null) {
+ // Prepare simple protocol string for ServerPort protocol
+ int index = name.indexOf('/');
+ if (index > 0)
+ protocol2 = name.substring(0, index);
+ else
+ protocol2 = name;
+ }
+ // Specified protocol is unknown, just use as is
+ else {
+ name = protocol;
+ protocol2 = protocol;
+ }
+ }
}
- if ("HTTP/1.1".equals(protocol))
+ if (protocol2.toLowerCase().equals("http"))
contentTypes = new String[] { "web", "webservices" };
String secure = connector.getSecure();
if (secure != null && secure.length() > 0) {