You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by pm...@apache.org on 2007/08/02 07:51:21 UTC
svn commit: r562021 [4/4] - in /geronimo/server/branches/2.0:
applications/console/geronimo-console-framework/src/main/webapp/js/
applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/
applications/console/geronimo-co...
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -1,431 +1,422 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.geronimo.tomcat.connector;
-
-import java.net.InetAddress;
-
-import javax.management.j2ee.statistics.Stats;
-import javax.net.ssl.KeyManagerFactory;
-
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.management.StatisticsProvider;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.tomcat.TomcatContainer;
-import org.apache.geronimo.tomcat.stats.ConnectorStats;
-
-public class BaseHttp11ConnectorGBean extends ConnectorGBean implements Http11Protocol, StatisticsProvider {
-
- private String keystoreFileName;
-
- private String truststoreFileName;
-
- private String algorithm;
-
- // JSR77 stats
- private ConnectorStats connStatsProvider = new ConnectorStats();
-
- private boolean reset = true;
-
- public BaseHttp11ConnectorGBean(String name, String protocol, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, protocol, container, serverInfo);
-
- // Default the host to listen on all address is one was not specified
- if (address == null) {
- address = "0.0.0.0";
- }
-
- // Must have a port
- if (port == 0) {
- throw new IllegalArgumentException("Must declare a port.");
- }
-
- connector.setAttribute("address", address);
- connector.setAttribute("port", port);
-
- }
- protected void initProtocol() {}
-
- // Generic SSL
- public String getAlgorithm() {
- return algorithm;
- }
-
- public String getCiphers() {
- return (String) connector.getAttribute("ciphers");
- }
-
- public boolean getClientAuth() {
- Object value = connector.getAttribute("clientAuth");
- return value == null ? false : new Boolean(value.toString()).booleanValue();
- }
-
- public String getKeyAlias() {
- return (String) connector.getAttribute("keyAlias");
- }
-
- public String getKeystoreFile() {
- return keystoreFileName;
- }
-
- public String getKeystoreType() {
- return (String) connector.getAttribute("keystoreType");
- }
-
- public String getSslProtocol() {
- return (String) connector.getAttribute("sslProtocol");
- }
-
- public String getTruststoreFile() {
- return truststoreFileName;
- }
-
- public String getTruststoreType() {
- return (String) connector.getAttribute("truststoreType");
- }
-
- public void setAlgorithm(String algorithm) {
- this.algorithm = algorithm;
- if ("default".equalsIgnoreCase(algorithm)) {
- algorithm = KeyManagerFactory.getDefaultAlgorithm();
- }
- connector.setAttribute("algorithm", algorithm);
- }
-
- public void setCiphers(String ciphers) {
- connector.setAttribute("ciphers", ciphers);
- }
-
- public void setClientAuth(String clientAuth) {
- connector.setAttribute("clientAuth", new Boolean(clientAuth));
- }
-
- public void setKeyAlias(String keyAlias) {
- connector.setAttribute("keyAlias", keyAlias);
- }
-
- public void setKeystoreFile(String keystoreFile) {
- keystoreFileName = keystoreFile;
- connector.setAttribute("keystoreFile", serverInfo.resolveServerPath(keystoreFileName));
- }
-
- public void setKeystorePass(String keystorePass) {
- connector.setAttribute("keystorePass", keystorePass);
- }
-
- public void setKeystoreType(String keystoreType) {
- connector.setAttribute("keystoreType", keystoreType);
- }
-
- public void setSslProtocol(String sslProtocol) {
- connector.setAttribute("sslProtocol", sslProtocol);
- }
-
- public void setTruststoreFile(String truststoreFile) {
- truststoreFileName = truststoreFile;
- connector.setAttribute("truststoreFile", serverInfo.resolveServerPath(truststoreFileName));
- }
-
- public void setTruststorePass(String truststorePass) {
- connector.setAttribute("truststorePass", truststorePass);
- }
-
- public void setTruststoreType(String truststoreType) {
- connector.setAttribute("truststoreType", truststoreType);
- }
-
- // Generic HTTP
- public int getAcceptCount() {
- Object value = connector.getAttribute("acceptCount");
- return value == null ? 10 : Integer.parseInt(value.toString());
- }
-
- public String getAddress() {
- Object value = connector.getAttribute("address");
- if (value == null) {
- return "0.0.0.0";
- } else if (value instanceof InetAddress) {
- return ((InetAddress) value).getHostAddress();
- } else
- return value.toString();
- }
-
- public int getBufferSize() {
- Object value = connector.getAttribute("bufferSize");
- return value == null ? 2048 : Integer.parseInt(value.toString());
- }
-
- public String getCompressableMimeType() {
- return (String) connector.getAttribute("compressableMimeType");
- }
-
- public String getCompression() {
- return (String) connector.getAttribute("compression");
- }
-
- public int getConnectionLinger() {
- Object value = connector.getAttribute("connectionLinger");
- return value == null ? -1 : Integer.parseInt(value.toString());
- }
-
- public int getConnectionTimeout() {
- Object value = connector.getAttribute("connectionTimeout");
- return value == null ? 60000 : Integer.parseInt(value.toString());
- }
-
- public boolean getDisableUploadTimeout() {
- Object value = connector.getAttribute("disableUploadTimeout");
- return value == null ? true : new Boolean(value.toString()).booleanValue();
- }
-
- public String getExecutor() {
- return (String) connector.getAttribute("Executor");
- }
-
- public int getKeepAliveTimeout() {
- Object value = connector.getAttribute("keepAliveTimeout");
- return value == null ? getConnectionTimeout() : Integer.parseInt(value.toString());
- }
-
- public int getMaxHttpHeaderSize() {
- Object value = connector.getAttribute("maxHttpHeaderSize");
- return value == null ? 4096 : Integer.parseInt(value.toString());
- }
-
- public int getMaxKeepAliveRequests() {
- Object value = connector.getAttribute("maxKeepAliveRequests");
- return value == null ? 100 : Integer.parseInt(value.toString());
- }
-
- public int getMaxThreads() {
- Object value = connector.getAttribute("maxThreads");
- return value == null ? 200 : Integer.parseInt(value.toString());
- }
-
- public String getNoCompressionUserAgents() {
- return (String) connector.getAttribute("noCompressionUserAgents");
- }
-
- public int getPort() {
- return connector.getPort();
- }
-
- public String getRestrictedUserAgents() {
- return (String) connector.getAttribute("restrictedUserAgents");
- }
-
- public String getServer() {
- return (String) connector.getAttribute("server");
- }
-
- public int getSocketBuffer() {
- Object value = connector.getAttribute("socketBuffer");
- return value == null ? 9000 : Integer.parseInt(value.toString());
- }
-
- public boolean getTcpNoDelay() {
- Object value = connector.getAttribute("tcpNoDelay");
- return value == null ? true : new Boolean(value.toString()).booleanValue();
- }
-
- public int getThreadPriority() {
- Object value = connector.getAttribute("threadPriority");
- return value == null ? Thread.NORM_PRIORITY : Integer.parseInt(value.toString());
- }
-
- public void setAcceptCount(int acceptCount) {
- connector.setAttribute("acceptCount", new Integer(acceptCount));
- }
-
- public void setAddress(String address) {
- connector.setAttribute("address", address);
- }
-
- public void setBufferSize(int bufferSize) {
- connector.setAttribute("bufferSize", new Integer(bufferSize));
- }
-
- public void setCompressableMimeType(int compressableMimeType) {
- connector.setAttribute("compressableMimeType", compressableMimeType);
- }
-
- public void setCompression(String compression) {
- connector.setAttribute("compression", compression);
- }
-
- public void setConnectionLinger(int connectionLinger) {
- connector.setAttribute("connectionLinger", new Integer(connectionLinger));
- }
-
- public void setConnectionTimeout(int connectionTimeout) {
- connector.setAttribute("connectionTimeout", new Integer(connectionTimeout));
- }
-
- public void setDisableUploadTimeout(boolean disableUploadTimeout) {
- connector.setAttribute("disableUploadTimeout", new Boolean(disableUploadTimeout));
- }
-
- public void setExecutor(String executor) {
- connector.setAttribute("executor", executor);
- }
-
- public void setKeepAliveTimeout(int keepAliveTimeout) {
- connector.setAttribute("keepAliveTimeout", keepAliveTimeout);
- }
-
- public void setMaxHttpHeaderSize(int maxHttpHeaderSize) {
- connector.setAttribute("maxHttpHeaderSize", new Integer(maxHttpHeaderSize));
- }
-
- public void setMaxKeepAliveRequests(int maxKeepAliveRequests) {
- connector.setAttribute("maxKeepAliveRequests", new Integer(maxKeepAliveRequests));
- }
-
- public void setMaxThreads(int maxThreads) {
- connector.setAttribute("maxThreads", new Integer(maxThreads));
- }
-
- public void setNoCompressionUserAgents(String noCompressionUserAgents) {
- connector.setAttribute("noCompressionUserAgents", noCompressionUserAgents);
- }
-
- public void setPort(int port) {
- connector.setPort(port);
- }
-
- public void setRestrictedUserAgents(String restrictedUserAgents) {
- connector.setAttribute("restrictedUserAgents", restrictedUserAgents);
- }
-
- public void setServer(String server) {
- connector.setAttribute("server", server);
- }
-
- public void setSocketBuffer(int socketBuffer) {
- connector.setAttribute("socketBuffer", new Integer(socketBuffer));
- }
-
- public void setTcpNoDelay(boolean tcpNoDelay) {
- connector.setAttribute("tcpNoDelay", new Boolean(tcpNoDelay));
- }
-
- public void setThreadPriority(int threadPriority) {
- connector.setAttribute("threadPriority", new Integer(threadPriority));
- }
-
- // Statistics Provider
-
- public Stats getStats() {
- String port = String.valueOf(getPort());
- if (reset) {
- reset = false;
- return connStatsProvider.getStats(port);
- } else
- return connStatsProvider.updateStats(port);
- }
-
- public void resetStats() {
- reset = true;
- }
-
- public static final GBeanInfo GBEAN_INFO;
-
- static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", BaseHttp11ConnectorGBean.class, ConnectorGBean.GBEAN_INFO);
- infoFactory.addInterface(Http11Protocol.class,
- new String[] {
- //HTTP Attributes
- "acceptCount",
- "address",
- "bufferSize",
- "compressableMimeType",
- "compression",
- "connectionLinger",
- "connectionTimeout",
- "executor",
- "keepAliveTimeout",
- "disableUploadTimeout",
- "maxHttpHeaderSize",
- "maxKeepAliveRequests",
- "maxThreads",
- "noCompressionUserAgents",
- "port",
- "restrictedUserAgents",
- "server",
- "socketBuffer",
- "tcpNoDelay",
- "threadPriority",
- //SSL Attributes
- "algorithm",
- "clientAuth",
- "keystoreFile",
- "keystorePass",
- "keystoreType",
- "sslProtocol",
- "ciphers",
- "keyAlias",
- "truststoreFile",
- "truststorePass",
- "truststoreType"
- },
- new String[] {
- //HTTP Attributes
- "acceptCount",
- "address",
- "bufferSize",
- "compressableMimeType",
- "compression",
- "connectionLinger",
- "connectionTimeout",
- "executor",
- "keepAliveTimeout",
- "disableUploadTimeout",
- "maxHttpHeaderSize",
- "maxKeepAliveRequests",
- "maxThreads",
- "noCompressionUserAgents",
- "port",
- "restrictedUserAgents",
- "server",
- "socketBuffer",
- "tcpNoDelay",
- "threadPriority",
- //SSL Attributes
- "algorithm",
- "clientAuth",
- "keystoreFile",
- "keystorePass",
- "keystoreType",
- "sslProtocol",
- "ciphers",
- "keyAlias",
- "truststoreFile",
- "truststorePass",
- "truststoreType"
- }
- );
- infoFactory.setConstructor(new String[] { "name", "protocol", "address", "port", "TomcatContainer", "ServerInfo"});
- GBEAN_INFO = infoFactory.getBeanInfo();
- }
-
- public static GBeanInfo getGBeanInfo() {
- return GBEAN_INFO;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.geronimo.tomcat.connector;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+
+import javax.management.j2ee.statistics.Stats;
+import javax.net.ssl.KeyManagerFactory;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.management.StatisticsProvider;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.tomcat.stats.ConnectorStats;
+
+public abstract class BaseHttp11ConnectorGBean extends ConnectorGBean implements BaseHttp11Protocol, StatisticsProvider {
+
+ protected String connectHost;
+
+ // JSR77 stats
+ private ConnectorStats connStatsProvider = new ConnectorStats();
+
+ private boolean reset = true;
+
+ public BaseHttp11ConnectorGBean(String name, Map initParams, String tomcatProtocol, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, tomcatProtocol, container, serverInfo);
+
+ // Default the host to listen on all address is one was not specified
+ if (host == null) {
+ host = "0.0.0.0";
+ }
+
+ // Must have a port
+ if (port == 0) {
+ throw new IllegalArgumentException("Must declare a port.");
+ }
+
+ connector.setAttribute("host", host);
+ connector.setPort(port);
+
+ }
+
+ protected void initProtocol() {}
+
+ public String getConnectUrl() {
+ if(connectHost == null) {
+ String host = getAddress();
+ if(host == null || host.equals("0.0.0.0") || host.equals("0:0:0:0:0:0:0:1")) {
+ InetAddress address = null;
+ try {
+ address = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ host = "unknown-host";
+ }
+ if(address != null) {
+ host = address.getCanonicalHostName();
+ if(host == null || host.equals("")) {
+ host = address.getHostAddress();
+ }
+ }
+ }
+ // this host address could be in IPv6 format,
+ // which means we need to wrap it in brackets
+ if (host.indexOf(":") >= 0) {
+ host = "[" + host + "]";
+ }
+ connectHost = host;
+ }
+ return getScheme().toLowerCase()+"://"+connectHost+(getPort() == getDefaultPort() ? "" : ":"+getPort());
+ }
+
+ public abstract int getDefaultPort();
+
+
+ // Generic HTTP
+ public int getAcceptCount() {
+ Object value = connector.getAttribute("acceptCount");
+ return value == null ? 10 : Integer.parseInt(value.toString());
+ }
+
+ public String getAddress() {
+ Object value = connector.getAttribute("address");
+ if (value == null) {
+ return "0.0.0.0";
+ } else if (value instanceof InetAddress) {
+ return ((InetAddress) value).getHostAddress();
+ } else
+ return value.toString();
+ }
+
+ public int getBufferSize() {
+ Object value = connector.getAttribute("bufferSize");
+ return value == null ? 2048 : Integer.parseInt(value.toString());
+ }
+
+ public String getCompressableMimeType() {
+ return (String) connector.getAttribute("compressableMimeType");
+ }
+
+ public String getCompression() {
+ return (String) connector.getAttribute("compression");
+ }
+
+ public int getConnectionLinger() {
+ Object value = connector.getAttribute("connectionLinger");
+ return value == null ? -1 : Integer.parseInt(value.toString());
+ }
+
+ public int getConnectionTimeout() {
+ Object value = connector.getAttribute("connectionTimeout");
+ return value == null ? 60000 : Integer.parseInt(value.toString());
+ }
+
+ public boolean getDisableUploadTimeout() {
+ Object value = connector.getAttribute("disableUploadTimeout");
+ return value == null ? true : new Boolean(value.toString()).booleanValue();
+ }
+
+ public String getExecutor() {
+ Object value = connector.getAttribute("executor");
+ if (value == null)
+ return null;
+
+ if (value instanceof String)
+ return (String)value;
+
+ return (String) value.getClass().getName();
+ }
+
+ public String getHost() {
+ return getAddress();
+ }
+
+ public InetSocketAddress getListenAddress() {
+ return new InetSocketAddress(getHost(), getPort());
+ }
+
+ public int getKeepAliveTimeout() {
+ Object value = connector.getAttribute("keepAliveTimeout");
+ return value == null ? getConnectionTimeout() : Integer.parseInt(value.toString());
+ }
+
+ public int getMaxHttpHeaderSize() {
+ Object value = connector.getAttribute("maxHttpHeaderSize");
+ return value == null ? 4096 : Integer.parseInt(value.toString());
+ }
+
+ public int getMaxKeepAliveRequests() {
+ Object value = connector.getAttribute("maxKeepAliveRequests");
+ return value == null ? 100 : Integer.parseInt(value.toString());
+ }
+
+ public int getMaxThreads() {
+ Object value = connector.getAttribute("maxThreads");
+ return value == null ? 200 : Integer.parseInt(value.toString());
+ }
+
+ public int getMaxSpareThreads() {
+ Object value = connector.getAttribute("maxSpareThreads");
+ return value == null ? 100 : Integer.parseInt(value.toString());
+ }
+
+ public int getMinSpareThreads() {
+ Object value = connector.getAttribute("minSpareThreads");
+ return value == null ? 10 : Integer.parseInt(value.toString());
+ }
+
+ public String getNoCompressionUserAgents() {
+ return (String) connector.getAttribute("noCompressionUserAgents");
+ }
+
+ public int getPort() {
+ return connector.getPort();
+ }
+
+ public String getRestrictedUserAgents() {
+ return (String) connector.getAttribute("restrictedUserAgents");
+ }
+
+ public String getServer() {
+ return (String) connector.getAttribute("server");
+ }
+
+ public int getSocketBuffer() {
+ Object value = connector.getAttribute("socketBuffer");
+ return value == null ? 9000 : Integer.parseInt(value.toString());
+ }
+
+ public boolean getTcpNoDelay() {
+ Object value = connector.getAttribute("tcpNoDelay");
+ return value == null ? true : new Boolean(value.toString()).booleanValue();
+ }
+
+ public int getThreadPriority() {
+ Object value = connector.getAttribute("threadPriority");
+ return value == null ? Thread.NORM_PRIORITY : Integer.parseInt(value.toString());
+ }
+
+ public void setAcceptCount(int acceptCount) {
+ connector.setAttribute("acceptCount", new Integer(acceptCount));
+ }
+
+ public void setAddress(String address) {
+ connector.setAttribute("address", address);
+ }
+
+ public void setBufferSize(int bufferSize) {
+ connector.setAttribute("bufferSize", new Integer(bufferSize));
+ }
+
+ public void setCompressableMimeType(String compressableMimeType) {
+ connector.setAttribute("compressableMimeType", compressableMimeType);
+ }
+
+ public void setCompression(String compression) {
+ connector.setAttribute("compression", compression);
+ }
+
+ public void setConnectionLinger(int connectionLinger) {
+ connector.setAttribute("connectionLinger", new Integer(connectionLinger));
+ }
+
+ public void setConnectionTimeout(int connectionTimeout) {
+ connector.setAttribute("connectionTimeout", new Integer(connectionTimeout));
+ }
+
+ public void setDisableUploadTimeout(boolean disableUploadTimeout) {
+ connector.setAttribute("disableUploadTimeout", new Boolean(disableUploadTimeout));
+ }
+
+ public void setExecutor(String executor) {
+ connector.setAttribute("executor", executor);
+ }
+
+ public void setHost(String host) {
+ setAddress(host);
+ }
+
+ public void setKeepAliveTimeout(int keepAliveTimeout) {
+ connector.setAttribute("keepAliveTimeout", keepAliveTimeout);
+ }
+
+ public void setMaxHttpHeaderSize(int maxHttpHeaderSize) {
+ connector.setAttribute("maxHttpHeaderSize", new Integer(maxHttpHeaderSize));
+ }
+
+ public void setMaxKeepAliveRequests(int maxKeepAliveRequests) {
+ connector.setAttribute("maxKeepAliveRequests", new Integer(maxKeepAliveRequests));
+ }
+
+ public void setMaxThreads(int maxThreads) {
+ connector.setAttribute("maxThreads", new Integer(maxThreads));
+ }
+
+ public void setMaxSpareThreads(int maxSpareThreads) {
+ connector.setAttribute("maxSpareThreads", new Integer(maxSpareThreads));
+ }
+
+ public void setMinSpareThreads(int minSpareThreads) {
+ connector.setAttribute("minSpareThreads", new Integer(minSpareThreads));
+ }
+
+ public void setNoCompressionUserAgents(String noCompressionUserAgents) {
+ connector.setAttribute("noCompressionUserAgents", noCompressionUserAgents);
+ }
+
+ public void setPort(int port) {
+ connector.setPort(port);
+ }
+
+ public void setRestrictedUserAgents(String restrictedUserAgents) {
+ connector.setAttribute("restrictedUserAgents", restrictedUserAgents);
+ }
+
+ public void setServer(String server) {
+ if (server.equals(""))
+ server = null;
+ connector.setAttribute("server", server);
+ }
+
+ public void setSocketBuffer(int socketBuffer) {
+ connector.setAttribute("socketBuffer", new Integer(socketBuffer));
+ }
+
+ public void setTcpNoDelay(boolean tcpNoDelay) {
+ connector.setAttribute("tcpNoDelay", new Boolean(tcpNoDelay));
+ }
+
+ public void setThreadPriority(int threadPriority) {
+ connector.setAttribute("threadPriority", new Integer(threadPriority));
+ }
+
+ // Statistics Provider
+
+ public boolean isStatisticsProvider() {
+ return true;
+ }
+
+ public Stats getStats() {
+ String port = String.valueOf(getPort());
+ if (reset) {
+ reset = false;
+ return connStatsProvider.getStats(port);
+ } else
+ return connStatsProvider.updateStats(port);
+ }
+
+ public void resetStats() {
+ reset = true;
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", BaseHttp11ConnectorGBean.class, ConnectorGBean.GBEAN_INFO);
+ infoFactory.addInterface(BaseHttp11Protocol.class,
+ new String[] {
+ //HTTP Attributes
+ "acceptCount",
+ "address",
+ "bufferSize",
+ "compressableMimeType",
+ "compression",
+ "connectionLinger",
+ "connectionTimeout",
+ "executor",
+ "host",
+ "keepAliveTimeout",
+ "disableUploadTimeout",
+ "maxHttpHeaderSize",
+ "maxKeepAliveRequests",
+ "maxThreads",
+ "maxSpareThreads",
+ "minSpareThreads",
+ "noCompressionUserAgents",
+ "port",
+ "restrictedUserAgents",
+ "server",
+ "socketBuffer",
+ "tcpNoDelay",
+ "threadPriority",
+ //SSL Attributes
+ "algorithm",
+ "clientAuth",
+ "keystoreFile",
+ "keystorePass",
+ "keystoreType",
+ "sslProtocol",
+ "ciphers",
+ "keyAlias",
+ "truststoreFile",
+ "truststorePass",
+ "truststoreType"
+ },
+ new String[] {
+ //HTTP Attributes
+ "acceptCount",
+ "address",
+ "bufferSize",
+ "compressableMimeType",
+ "compression",
+ "connectionLinger",
+ "connectionTimeout",
+ "executor",
+ "host",
+ "keepAliveTimeout",
+ "disableUploadTimeout",
+ "maxHttpHeaderSize",
+ "maxKeepAliveRequests",
+ "maxThreads",
+ "maxSpareThreads",
+ "minSpareThreads",
+ "noCompressionUserAgents",
+ "port",
+ "restrictedUserAgents",
+ "server",
+ "socketBuffer",
+ "tcpNoDelay",
+ "threadPriority",
+ //SSL Attributes
+ "algorithm",
+ "clientAuth",
+ "keystoreFile",
+ "keystorePass",
+ "keystoreType",
+ "sslProtocol",
+ "ciphers",
+ "keyAlias",
+ "truststoreFile",
+ "truststorePass",
+ "truststoreType"
+ }
+ );
+ infoFactory.setConstructor(new String[] { "name", "initParams", "protocol", "host", "port", "TomcatContainer", "ServerInfo"});
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11Protocol.java Wed Aug 1 22:51:18 2007
@@ -27,7 +27,7 @@
public int getBufferSize();
public void setBufferSize(int bufferSize);
public String getCompressableMimeType();
- public void setCompressableMimeType(int compressableMimeType);
+ public void setCompressableMimeType(String compressableMimeType);
public String getCompression();
public void setCompression(String compression);
public int getConnectionLinger();
@@ -36,6 +36,8 @@
public void setConnectionTimeout(int connectionTimeout);
public String getExecutor();
public void setExecutor(String executor);
+ public String getHost();
+ public void setHost(String host);
public int getKeepAliveTimeout();
public void setKeepAliveTimeout(int keepAliveTimeout);
public boolean getDisableUploadTimeout();
@@ -46,6 +48,10 @@
public void setMaxKeepAliveRequests(int maxKeepAliveRequests);
public int getMaxThreads();
public void setMaxThreads(int maxThreads);
+ public int getMaxSpareThreads();
+ public void setMaxSpareThreads(int maxSpareThreads);
+ public int getMinSpareThreads();
+ public void setMinSpareThreads(int minSpareThreads);
public String getNoCompressionUserAgents();
public void setNoCompressionUserAgents(String noCompressionUserAgents);
public int getPort();
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/CommonProtocol.java Wed Aug 1 22:51:18 2007
@@ -30,6 +30,7 @@
public int getMaxSavePostSize();
public void setMaxSavePostSize(int maxPostSize);
public String getProtocol();
+ public String getTomcatProtocol();
public String getProxyName();
public void setProxyName(String proxyName);
public int getProxyPort();
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -18,6 +18,11 @@
*/
package org.apache.geronimo.tomcat.connector;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.j2ee.statistics.Stats;
+
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.commons.logging.Log;
@@ -26,13 +31,13 @@
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.BaseGBean;
import org.apache.geronimo.tomcat.ObjectRetriever;
import org.apache.geronimo.tomcat.TomcatContainer;
-public class ConnectorGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever, CommonProtocol {
+public abstract class ConnectorGBean extends BaseGBean implements CommonProtocol, GBeanLifecycle, ObjectRetriever, TomcatWebConnector {
private static final Log log = LogFactory.getLog(ConnectorGBean.class);
@@ -46,8 +51,12 @@
private String name;
- public ConnectorGBean(String name, String protocol, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super();
+ public ConnectorGBean(String name, Map initParams, String tomcatProtocol, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+
+ //Relief for new Tomcat-only parameters that may come in the future
+ if (initParams == null){
+ initParams = new HashMap();
+ }
// Do we really need this?? For Tomcat I don't think so...
// validateProtocol(protocol);
@@ -64,14 +73,16 @@
throw new IllegalArgumentException("serverInfo cannot be null.");
}
- initProtocol();
+ tomcatProtocol = validateProtocol(tomcatProtocol);
this.name = name;
this.container = container;
this.serverInfo = serverInfo;
// Create the Connector object
- connector = new Connector(protocol);
+ connector = new Connector(tomcatProtocol);
+
+ setParameters(connector, initParams);
}
@@ -104,7 +115,15 @@
* Ensures that this implementation can handle the requested protocol.
* @param protocol
*/
- protected void initProtocol() {}
+ protected String validateProtocol(String tomcatProtocol) { return tomcatProtocol;}
+
+ public abstract int getDefaultPort();
+
+ public abstract String getGeronimoProtocol();
+
+ public abstract Stats getStats();
+
+ public abstract void resetStats();
public Object getInternalObject() {
return connector;
@@ -140,6 +159,13 @@
}
public String getProtocol() {
+ //This is totally wrong on the Geronimo side and needs to be re-thought out.
+ //This was done to shoe horn in gerneric Geronimo protocols which should have no relation
+ //to the container's scheme. This whole idea needs rework.
+ return getGeronimoProtocol();
+ }
+
+ public String getTomcatProtocol() {
return connector.getProtocol();
}
@@ -180,6 +206,8 @@
}
public void setProxyName(String proxyName) {
+ if (proxyName.equals(""))
+ proxyName = null;
connector.setProxyName(proxyName);
}
@@ -247,10 +275,12 @@
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", ConnectorGBean.class);
infoFactory.addAttribute("name", String.class, true);
+ infoFactory.addAttribute("initParams", Map.class, true);
infoFactory.addAttribute("protocol", String.class, true);
infoFactory.addReference(CONNECTOR_CONTAINER_REFERENCE, TomcatContainer.class, NameFactory.GERONIMO_SERVICE);
infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
infoFactory.addInterface(ObjectRetriever.class);
+ infoFactory.addInterface(TomcatWebConnector.class);
infoFactory.addInterface(CommonProtocol.class,
new String[]{
@@ -260,6 +290,7 @@
"maxPostSize",
"maxSavePostSize",
"protocol",
+ "tomcatProtocol",
"proxyName",
"proxyPort",
"redirectPort",
@@ -279,6 +310,7 @@
"maxPostSize",
"maxSavePostSize",
"protocol",
+ "tomcatProtocol",
"proxyName",
"proxyPort",
"redirectPort",
@@ -291,7 +323,7 @@
"xpoweredBy"
}
);
- infoFactory.setConstructor(new String[] { "name", "protocol", "TomcatContainer", "ServerInfo" });
+ infoFactory.setConstructor(new String[] { "name", "initParams", "protocol", "TomcatContainer", "ServerInfo" });
GBEAN_INFO = infoFactory.getBeanInfo();
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java (from r560392, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java&r1=560392&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -28,8 +28,16 @@
public class Http11APRConnectorGBean extends BaseHttp11ConnectorGBean implements Http11APRProtocol {
- public Http11APRConnectorGBean(String name, Map initParams, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, initParams, "org.apache.coyote.http11.Http11AprProtocol", address, port, container, serverInfo);
+ private String certificateFile;
+ private String certificateKeyFile;
+ private String caCertificateFile;
+ private String caCertificatePath;
+ private String certificateChainFile;
+ private String revocationPath;
+ private String revocationFile;
+
+ public Http11APRConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, "org.apache.coyote.http11.Http11AprProtocol", host, port, container, serverInfo);
}
@Override
@@ -58,23 +66,23 @@
}
public String getSslCACertificateFile() {
- return (String) connector.getAttribute("SSLCACertificateFile");
+ return caCertificateFile;
}
public String getSslCACertificatePath() {
- return (String) connector.getAttribute("SSLCACertificatePath");
+ return caCertificatePath;
}
public String getSslCertificateChainFile() {
- return (String) connector.getAttribute("SSLCertificateChainFile");
+ return certificateChainFile;
}
public String getSslCertificateFile() {
- return (String) connector.getAttribute("SSLCertificateFile");
+ return certificateFile;
}
public String getSslCertificateKeyFile() {
- return (String) connector.getAttribute("SSLCertificateKeyFile");
+ return certificateKeyFile;
}
public String getSslCipherSuite() {
@@ -86,11 +94,11 @@
}
public String getSslCARevocationFile() {
- return (String) connector.getAttribute("SSLCARevocationFile");
+ return revocationFile;
}
public String getSslCARevocationPath() {
- return (String) connector.getAttribute("SSLCARevocationPath");
+ return revocationPath;
}
public String getSslVerifyClient() {
@@ -120,23 +128,53 @@
}
public void setSslCACertificateFile(String sslCACertificateFile) {
- connector.setAttribute("SSLCACertificateFile", sslCACertificateFile);
+ if (sslCACertificateFile != null && sslCACertificateFile.equals(""))
+ sslCACertificateFile = null;
+ caCertificateFile = sslCACertificateFile;
+ if (caCertificateFile == null)
+ connector.setAttribute("SSLCACertificateFile", null);
+ else
+ connector.setAttribute("SSLCACertificateFile", serverInfo.resolveServerPath(caCertificateFile));
}
public void setSslCACertificatePath(String sslCACertificatePath) {
- connector.setAttribute("SSLCACertificatePath", sslCACertificatePath);
+ if (sslCACertificatePath != null && sslCACertificatePath.equals(""))
+ sslCACertificatePath = null;
+ caCertificatePath = sslCACertificatePath;
+ if (caCertificatePath == null)
+ connector.setAttribute("SSLCACertificatePath", null);
+ else
+ connector.setAttribute("SSLCACertificatePath", serverInfo.resolveServerPath(caCertificatePath));
}
public void setSslCertificateChainFile(String sslCertificateChainFile) {
- connector.setAttribute("SSLCertificateChainFile", sslCertificateChainFile);
+ if (sslCertificateChainFile != null && sslCertificateChainFile.equals(""))
+ sslCertificateChainFile = null;
+ certificateChainFile = sslCertificateChainFile;
+ if (certificateChainFile == null)
+ connector.setAttribute("SSLCertificateChainFile", null);
+ else
+ connector.setAttribute("SSLCertificateChainFile", serverInfo.resolveServerPath(certificateChainFile));
}
public void setSslCertificateFile(String sslCertificateFile) {
- connector.setAttribute("SSLCertificateFile", sslCertificateFile);
+ if (sslCertificateFile != null && sslCertificateFile.equals(""))
+ sslCertificateFile = null;
+ certificateFile = sslCertificateFile;
+ if (certificateFile == null)
+ connector.setAttribute("SSLCertificateFile", null);
+ else
+ connector.setAttribute("SSLCertificateFile", serverInfo.resolveServerPath(certificateFile));
}
public void setSslCertificateKeyFile(String sslCertificateKeyFile) {
- connector.setAttribute("SSLCertificateKeyFile", sslCertificateKeyFile);
+ if (sslCertificateKeyFile != null && sslCertificateKeyFile.equals(""))
+ sslCertificateKeyFile = null;
+ certificateKeyFile = sslCertificateKeyFile;
+ if (certificateKeyFile == null)
+ connector.setAttribute("SSLCertificateKeyFile", null);
+ else
+ connector.setAttribute("SSLCertificateKeyFile", serverInfo.resolveServerPath(certificateKeyFile));
}
public void setSslCipherSuite(String sslCipherSuite) {
@@ -144,6 +182,8 @@
}
public void setSslPassword(String sslPassword) {
+ if (sslPassword != null && sslPassword.equals(""))
+ sslPassword = null;
connector.setAttribute("SSLPassword", sslPassword);
}
@@ -152,11 +192,24 @@
}
public void setSslCARevocationFile(String sslCARevocationFile) {
- connector.setAttribute("SSLCARevocationFile", sslCARevocationFile);
+ if (sslCARevocationFile!= null && sslCARevocationFile.equals(""))
+ sslCARevocationFile = null;
+ revocationFile = sslCARevocationFile;
+ if (revocationFile == null)
+ connector.setAttribute("SSLCARevocationFile", null);
+ else
+ connector.setAttribute("SSLCARevocationFile", serverInfo.resolveServerPath(revocationFile));
}
public void setSslCARevocationPath(String sslCARevocationPath) {
- connector.setAttribute("SSLCARevocationPath", sslCARevocationPath);
+ if (sslCARevocationPath!= null && sslCARevocationPath.equals(""))
+ sslCARevocationPath = null;
+ revocationPath = sslCARevocationPath;
+ if (revocationPath == null)
+ connector.setAttribute("SSLCARevocationPath", null);
+ else
+ connector.setAttribute("SSLCARevocationPath", serverInfo.resolveServerPath(revocationPath));
+
}
public void setSslVerifyClient(String sslVerifyClient) {
@@ -174,7 +227,7 @@
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Http11APRConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP APR", Http11APRConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
infoFactory.addInterface(Http11APRProtocol.class,
new String[] {
//APR Attributes
@@ -217,7 +270,7 @@
"sslCARevocationPath"
}
);
- infoFactory.setConstructor(new String[] { "name", "initParams", "address", "port", "TomcatContainer", "ServerInfo"});
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -18,26 +18,34 @@
*/
package org.apache.geronimo.tomcat.connector;
+import java.util.Map;
+
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.TomcatContainer;
-public class Http11ConnectorGBean extends BaseHttp11ConnectorGBean {
-
- public Http11ConnectorGBean(String name, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, "HTTP/1.1", address, port, container, serverInfo);
+public class Http11ConnectorGBean extends AbstractHttp11ConnectorGBean {
+
+ public Http11ConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, "org.apache.coyote.http11.Http11Protocol", host, port, container, serverInfo);
}
-
+
+ public int getDefaultPort() {
+ return 80;
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Http11ConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
- infoFactory.setConstructor(new String[] { "name", "address", "port", "TomcatContainer", "ServerInfo"});
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP BIO", Http11ConnectorGBean.class, AbstractHttp11ConnectorGBean.GBEAN_INFO);
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
- public static GBeanInfo getGBeanInfo() {
- return GBEAN_INFO;
- }
+
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -18,15 +18,26 @@
*/
package org.apache.geronimo.tomcat.connector;
+import java.util.Map;
+
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.management.geronimo.WebManager;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.TomcatContainer;
-public class Http11NIOConnectorGBean extends BaseHttp11ConnectorGBean implements Http11NIOProtocol{
+public class Http11NIOConnectorGBean extends AbstractHttp11ConnectorGBean implements Http11NIOProtocol{
- public Http11NIOConnectorGBean(String name, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, "org.apache.coyote.http11.Http11NioProtocol", address, port, container, serverInfo);
+ public Http11NIOConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, "org.apache.coyote.http11.Http11NioProtocol", host, port, container, serverInfo);
+ }
+
+ public int getDefaultPort() {
+ return 80;
+ }
+
+ public String getGeronimoProtocol(){
+ return WebManager.PROTOCOL_HTTP;
}
public int getAcceptorThreadCount() {
@@ -169,9 +180,9 @@
return value == null ? 5000 : Integer.parseInt(value.toString());
}
- public byte getSocket_soTrafficClass() {
+ public int getSocket_soTrafficClass() {
Object value = connector.getAttribute("socket.soTrafficClass");
- return value == null ? (0x04 | 0x08 | 0x010) : new Byte(value.toString()).byteValue();
+ return value == null ? (0x04 | 0x08 | 0x010) : new Integer(value.toString()).intValue();
}
public boolean getSocket_tcpNoDelay() {
@@ -194,8 +205,8 @@
return value == null ? true : new Boolean(value.toString()).booleanValue();
}
- public boolean getUseSendFile() {
- Object value = connector.getAttribute("useSendFile");
+ public boolean getUseSendfile() {
+ Object value = connector.getAttribute("useSendfile");
return value == null ? true : new Boolean(value.toString()).booleanValue();
}
@@ -311,8 +322,8 @@
connector.setAttribute("socket.soTimeout", new Integer(socket_soTimeout));
}
- public void setSocket_soTrafficClass(byte socket_soTrafficClass) {
- connector.setAttribute("socket.soTrafficClass", new Byte(socket_soTrafficClass));
+ public void setSocket_soTrafficClass(int socket_soTrafficClass) {
+ connector.setAttribute("socket.soTrafficClass", new Integer(socket_soTrafficClass));
}
public void setSocket_tcpNoDelay(boolean socket_tcpNoDelay) {
@@ -331,14 +342,14 @@
connector.setAttribute("useExecutor", new Boolean(useExecutor));
}
- public void setUseSendFile(boolean useSendFile) {
- connector.setAttribute("useSendFile", new Boolean(useSendFile));
+ public void setUseSendfile(boolean useSendfile) {
+ connector.setAttribute("useSendfile", new Boolean(useSendfile));
}
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Http11NIOConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
- infoFactory.addInterface(Http11Protocol.class,
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP NIO", Http11NIOConnectorGBean.class, AbstractHttp11ConnectorGBean.GBEAN_INFO);
+ infoFactory.addInterface(Http11NIOProtocol.class,
new String[] {
"useSendfile",
"useExecutor",
@@ -411,7 +422,7 @@
}
);
- infoFactory.setConstructor(new String[] { "name", "address", "port", "TomcatContainer", "ServerInfo"});
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOProtocol.java Wed Aug 1 22:51:18 2007
@@ -20,8 +20,8 @@
public interface Http11NIOProtocol {
- public boolean getUseSendFile();
- public void setUseSendFile(boolean useSendFile);
+ public boolean getUseSendfile();
+ public void setUseSendfile(boolean useSendfile);
public boolean getUseExecutor();
public void setUseExecutor(boolean useExecutor);
public int getAcceptorThreadCount();
@@ -72,8 +72,8 @@
public void setSocket_soLingerTime(int socket_soLingerTime);
public int getSocket_soTimeout();
public void setSocket_soTimeout(int socket_soTimeout);
- public byte getSocket_soTrafficClass();
- public void setSocket_soTrafficClass(byte socket_soTrafficClass);
+ public int getSocket_soTrafficClass();
+ public void setSocket_soTrafficClass(int socket_soTrafficClass);
public int getSocket_performanceConnectionTime();
public void setSocket_performanceConnectionTime(int socket_performanceConnectionTime);
public int getSocket_performanceLatency();
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11Protocol.java Wed Aug 1 22:51:18 2007
@@ -18,15 +18,16 @@
*/
package org.apache.geronimo.tomcat.connector;
-public interface Http11Protocol extends BaseHttp11Protocol {
+public interface Http11Protocol {
//Https
public String getAlgorithm();
public void setAlgorithm(String algorithm);
public boolean getClientAuth();
- public void setClientAuth(String clientAuth);
+ public void setClientAuth(boolean clientAuth);
public String getKeystoreFile();
public void setKeystoreFile(String keystoreFile);
+ public String getKeystorePass();
public void setKeystorePass(String keystorePass);
public String getKeystoreType();
public void setKeystoreType(String keystoreType);
@@ -38,6 +39,7 @@
public void setKeyAlias(String keyAlias);
public String getTruststoreFile();
public void setTruststoreFile(String truststoreFile);
+ public String getTruststorePass();
public void setTruststorePass(String truststorePass);
public String getTruststoreType();
public void setTruststoreType(String truststoreType);
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java (from r560392, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java&r1=560392&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -28,8 +28,8 @@
public class Https11APRConnectorGBean extends Http11APRConnectorGBean {
- public Https11APRConnectorGBean(String name, Map initParams, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, initParams, address, port, container, serverInfo);
+ public Https11APRConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, host, port, container, serverInfo);
setSslEnabled(true);
setScheme("https");
setSecure(true);
@@ -46,8 +46,8 @@
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Https11APRConnectorGBean.class, Http11APRConnectorGBean.GBEAN_INFO);
- infoFactory.setConstructor(new String[] { "name", "initParams", "address", "port", "TomcatContainer", "ServerInfo"});
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTPS APR", Https11APRConnectorGBean.class, Http11APRConnectorGBean.GBEAN_INFO);
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -18,25 +18,36 @@
*/
package org.apache.geronimo.tomcat.connector;
+import java.util.Map;
+
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.management.geronimo.WebManager;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.TomcatContainer;
public class Https11ConnectorGBean extends Http11ConnectorGBean {
- public Https11ConnectorGBean(String name, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, address, port, container, serverInfo);
+ public Https11ConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, host, port, container, serverInfo);
setSslEnabled(true);
setScheme("https");
setSecure(true);
}
+ public int getDefaultPort() {
+ return 443;
+ }
+
+ public String getGeronimoProtocol(){
+ return WebManager.PROTOCOL_HTTPS;
+ }
+
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Https11ConnectorGBean.class, Http11ConnectorGBean.GBEAN_INFO);
- infoFactory.setConstructor(new String[] { "name", "address", "port", "TomcatContainer", "ServerInfo"});
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTPS BIO", Https11ConnectorGBean.class, Http11ConnectorGBean.GBEAN_INFO);
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Copied: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java (from r559530, geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java?view=diff&rev=562021&p1=geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java&r1=559530&p2=geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java&r2=562021
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java Wed Aug 1 22:51:18 2007
@@ -18,25 +18,36 @@
*/
package org.apache.geronimo.tomcat.connector;
+import java.util.Map;
+
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.management.geronimo.WebManager;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.TomcatContainer;
public class Https11NIOConnectorGBean extends Http11NIOConnectorGBean {
- public Https11NIOConnectorGBean(String name, String address, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
- super(name, address, port, container, serverInfo);
+ public Https11NIOConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+ super(name, initParams, host, port, container, serverInfo);
setSslEnabled(true);
setScheme("https");
setSecure(true);
}
+ public int getDefaultPort() {
+ return 443;
+ }
+
+ public String getGeronimoProtocol(){
+ return WebManager.PROTOCOL_HTTPS;
+ }
+
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", Https11NIOConnectorGBean.class, Http11NIOConnectorGBean.GBEAN_INFO);
- infoFactory.setConstructor(new String[] { "name", "address", "port", "TomcatContainer", "ServerInfo"});
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTPS NIO", Https11NIOConnectorGBean.class, Http11NIOConnectorGBean.GBEAN_INFO);
+ infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Wed Aug 1 22:51:18 2007
@@ -44,6 +44,8 @@
import org.apache.geronimo.system.serverinfo.BasicServerInfo;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.testsupport.TestSupport;
+import org.apache.geronimo.tomcat.connector.ConnectorGBean;
+import org.apache.geronimo.tomcat.connector.Http11ConnectorGBean;
import org.apache.geronimo.tomcat.util.SecurityHolder;
import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
@@ -180,7 +182,7 @@
container = new TomcatContainer(cl, new File(BASEDIR, "target/var/catalina").toString(), null, engine, null, serverInfo, null, null);
container.doStart();
- connector = new ConnectorGBean("HTTP", null, "localhost", port++, container);
+ connector = new Http11ConnectorGBean("HTTP", null, "localhost", port++, container, serverInfo);
connector.doStart();
TransactionManagerImpl transactionManager = new TransactionManagerImpl();
Modified: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/StatTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/StatTest.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/StatTest.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/StatTest.java Wed Aug 1 22:51:18 2007
@@ -37,7 +37,6 @@
TomcatWebAppContext webModule;
webModule = setUpInsecureAppContext(new File(BASEDIR, "target/var/catalina/webapps/war1/").toURI(), new File(
BASEDIR, "target/var/catalina/webapps/war1/WEB-INF/web.xml").toURL(), null, null, null, null);
-
HttpURLConnection connection = (HttpURLConnection) new URL(connector.getConnectUrl() + "/test/hello.txt")
.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));