You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/01/09 00:24:59 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/server HttpServer.java ConnectionHandler.java Constants.java Endpoint.java EndpointManager.java HttpRequestAdapter.java HttpServerConnector.java ServerRequest.java ServerResponse.java ServletInputStreamImpl.java ServletOutputStreamImpl.java server.properties
costin 00/01/08 15:24:58
Modified: src/share/org/apache/tomcat/server HttpServer.java
Removed: src/share/org/apache/tomcat/server ConnectionHandler.java
Constants.java Endpoint.java EndpointManager.java
HttpRequestAdapter.java HttpServerConnector.java
ServerRequest.java ServerResponse.java
ServletInputStreamImpl.java
ServletOutputStreamImpl.java server.properties
Log:
Removed old HttpAdapter ( unused ).
HttpServer will turn into an interface that will work with any
adapter and has no more "standalone" code in it.
Also, removed the old "adapter" hack ( load a properties file from
classpath ) - XML can set it up now.
The code still exists - the new HttpAdapter ( in tomcat.service.http)
is based on the code in tomcat.server ( with cosmetic changes and following
the Adapter interfaces ). The code here was the original, in case something
gets wrong.
Revision Changes Path
1.7 +8 -82 jakarta-tomcat/src/share/org/apache/tomcat/server/HttpServer.java
Index: HttpServer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/HttpServer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HttpServer.java 2000/01/08 23:04:47 1.6
+++ HttpServer.java 2000/01/08 23:24:58 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/HttpServer.java,v 1.6 2000/01/08 23:04:47 costin Exp $
- * $Revision: 1.6 $
- * $Date: 2000/01/08 23:04:47 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/HttpServer.java,v 1.7 2000/01/08 23:24:58 costin Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/01/08 23:24:58 $
*
* ====================================================================
*
@@ -152,7 +152,7 @@
Properties props;
private StringManager sm =
- StringManager.getManager(Constants.Package);
+ StringManager.getManager("org.apache.tomcat.server");
private String hostname = "";
private String serverHeader = null;
@@ -233,18 +233,6 @@
contextM.setServerInfo(
contextM.getDefaultContext().getEngineHeader());
}
-
-
- props = new Properties();
- getProperties(props, Constants.Property.Name);
- // XXX make serverHeader a property of ContextM !
- /*
- * Whoever modifies this needs to check this modification is
- * ok with the code in com.jsp.runtime.ServletEngine or talk
- * to akv before you check it in.
- */
- serverHeader = props.getProperty(Constants.Property.ServerHeader,
- Constants.Property.ServerHeader);
}
@@ -415,6 +403,9 @@
*/
public String getServerHeader() {
+ // XXX XXX Ugly, but we want to remove the properties stuff
+ // which is worse
+ if(serverHeader==null) serverHeader="Tomcat Web Server 3.0";
return serverHeader;
}
@@ -551,71 +542,6 @@
}
}
- /**
- * Load the specified Properties from the specified file.
- *
- * @param props Properties to be loaded
- * @param propertyFileName Name of the file from which properties
- * should be loaded
- * @return The updated properties object
- */
- private Properties getProperties(Properties props, String propertyFileName) {
- try {
- InputStream is=this.getClass().getResourceAsStream(propertyFileName);
- if( is==null ) return props;
- props.load(is);
- } catch (IOException ioe) {
- }
-
- return props;
- }
-
- /** If no connector is added, will use a connector.properties file to "guess"
- what connector to use based on vhost/port. IF none found, use the default,
- which is the old HttpServer/EndpointManager
- */
- private ServerConnector findDefaultConnector( Properties def, String host, int port ) {
- // first, try "connector.properties" in CLASSPATH
- Properties props=new Properties( def );
- getProperties(props, CONNECTOR_PROP );
-
- String key = "connector." + host + "." + port + ".";
-
- String classN=props.getProperty( key + "class" ); // XXX constant, XML
-
- System.out.println("Setting up " + ((classN==null)?"HttpServer":classN) + " for " + host + ":" + port );
- if(classN != null ) {
- ServerConnector conn=null;
-
- try {
- Class c=Class.forName( classN );
- conn=(ServerConnector)c.newInstance();
- } catch(Exception ex) {
- ex.printStackTrace();
- // return new HttpServerConnector();
- return new HttpAdapter();
- }
-
- if( conn != null ) {
- // set all the connector.x properties to the connector
- int off=key.length();
- Enumeration e=props.keys();
- while( e.hasMoreElements() ) {
- String n=(String)e.nextElement();
- if( n.startsWith( key )) {
- String pn=n.substring( off );
- conn.setProperty( pn, props.getProperty( n ) );
- //System.out.println("Set " + pn + " = " + props.getProperty(n ));
- }
- }
- return conn;
- }
- }
- // default
- // HttpServerConnector con=new HttpServerConnector();
- return new HttpAdapter();
- }
-
/** Called before starting the connector
*/
private void initConnector() {
@@ -623,7 +549,7 @@
// find a connector for the vhost:port combination
// Use props and CONNECTOR_PROP to load configuration info
// default is HttpServerConnector
- addConnector( findDefaultConnector(props, getHostName(), getPort()) );
+ addConnector( new HttpAdapter() );
}
for( int i=0; i<connector_count; i++ ) {
connector[i].setAttribute(SERVER, this);
Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/server
HttpServer.java ConnectionHandler.java Constants.java Endpoint.java
EndpointManager.java HttpRequestAdapter.java HttpServerConnector.java
ServerRequest.java ServerResponse.java ServletInputStreamImpl.java
ServletOutputStreamImpl.java server.properties
Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
costin@locus.apache.org wrote:
> costin 00/01/08 15:24:58
>
> Modified: src/share/org/apache/tomcat/server HttpServer.java
> Removed: src/share/org/apache/tomcat/server ConnectionHandler.java
> Constants.java Endpoint.java EndpointManager.java
> HttpRequestAdapter.java HttpServerConnector.java
> ServerRequest.java ServerResponse.java
> ServletInputStreamImpl.java
> ServletOutputStreamImpl.java server.properties
> Log:
> Removed old HttpAdapter ( unused ).
> HttpServer will turn into an interface that will work with any
> adapter and has no more "standalone" code in it.
>
Costin, this one causes a compile error ("Undefined variable or class name: Constants") on line 84 of
org.apache.tomcat.server/HttpResponseAdapter. The line in question says:
StringManager.getManager(Constants.Package);
The problem is caused by the fact that you removed the Constants.java class from this package. Could you please put it back, or
else remove the need for it so compiles work again?
Craig