cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2001-07-22 Thread pier

pier01/07/22 15:49:50

  Modified:catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  Updating also the WARP connector to bind to the network in initialize().
  
  Revision  ChangesPath
  1.14  +20 -22
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
  
  Index: WarpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WarpConnector.java2001/07/22 18:38:05 1.13
  +++ WarpConnector.java2001/07/22 22:49:50 1.14
  @@ -440,6 +440,22 @@
   if (initialized)
   throw new LifecycleException("Already initialized");
   this.initialized=true;
  +
  +// Get a hold on a server socket
  +try {
  +ServerSocketFactory fact=this.getFactory();
  +int port=this.getPort();
  +int accc=this.getAcceptCount();
  +
  +if (this.getAddress()==null) {
  +this.server=fact.createSocket(port,accc);
  +} else {
  +InetAddress addr=InetAddress.getByName(this.getAddress());
  +this.server=fact.createSocket(port,accc,addr);
  +}
  +} catch (IOException e) {
  +throw new LifecycleException("Error creating server socket",e);
  +}
   }
   
   /**
  @@ -448,6 +464,10 @@
   public void start() throws LifecycleException {
   if (started) throw new LifecycleException("Already started");
   
  +// Can't get a hold of a server socket
  +if (this.server==null)
  +throw new LifecycleException("Server socket not created");
  +
   lifecycle.fireLifecycleEvent(START_EVENT, null);
   
   this.started = true;
  @@ -527,28 +547,6 @@
* Start accepting WARP requests from the network.
*/
   public void run() {
  -// Get a hold on a server socket
  -try {
  -ServerSocketFactory fact=this.getFactory();
  -int port=this.getPort();
  -int accc=this.getAcceptCount();
  -
  -if (this.getAddress()==null) {
  -this.server=fact.createSocket(port,accc);
  -} else {
  -InetAddress addr=InetAddress.getByName(this.getAddress());
  -this.server=fact.createSocket(port,accc,addr);
  -}
  -} catch (IOException e) {
  -logger.log("Error creating server socket",e);
  -}
  -
  -// Can't get a hold of a server socket
  -if (this.server==null) {
  -logger.log("Unable to create server socket");
  -return;
  -}
  -
   // Start accepting connections
   try {
   while (this.isStarted()) {
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2001-07-19 Thread pier

pier01/07/19 17:01:00

  Modified:catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  New WARP implementation from Jakarta-Tomcat-Connectors
  
  Revision  ChangesPath
  1.12  +356 -233  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
  
  Index: WarpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WarpConnector.java2001/05/09 23:42:17 1.11
  +++ WarpConnector.java2001/07/20 00:01:00 1.12
  @@ -2,7 +2,7 @@
*   *
* The Apache Software License,  Version 1.1 *
*   *
  - * Copyright (c) 1999, 2000  The Apache Software Foundation. *
  + *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
*   All rights reserved.*
*   *
* = *
  @@ -56,193 +56,171 @@
* = */
   package org.apache.catalina.connector.warp;
   
  -import java.io.*;
  -import java.net.*;
  -import org.apache.catalina.Container;
  +import java.io.IOException;
  +import java.net.InetAddress;
  +import java.net.ServerSocket;
  +import java.net.Socket;
  +import java.util.Random;
  +import java.util.Vector;
  +
   import org.apache.catalina.Connector;
  +import org.apache.catalina.Container;
  +import org.apache.catalina.Context;
  +import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.LifecycleException;
  +import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.Logger;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.net.DefaultServerSocketFactory;
   import org.apache.catalina.net.ServerSocketFactory;
  -import org.apache.catalina.Lifecycle;
  -import org.apache.catalina.LifecycleEvent;
  -import org.apache.catalina.LifecycleException;
  -import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.util.LifecycleSupport;
  -import org.apache.catalina.connector.HttpRequestBase;
  -import org.apache.catalina.connector.HttpResponseBase;
   
  -/**
  - *
  - *
  - * @author mailto:[EMAIL PROTECTED]";>Pier Fumagalli
  - * @author Copyright © 1999, 2000 http://www.apache.org";>The
  - * Apache Software Foundation.
  - * @version CVS $Id: WarpConnector.java,v 1.11 2001/05/09 23:42:17 craigmcc Exp $
  - */
   public class WarpConnector implements Connector, Lifecycle, Runnable {
   
  -// -- CONSTANTS
  +/*  */
  +/* Instance variables   */
  +/*  */
  +
  +/*  */
  +/* Local variables */
  +
  +/** The running thread accepting connections */
  +private Thread thread=null;
  +/** The server socket. */
  +private ServerSocket server=null;
  +/** Our WarpLogger. */
  +private WarpLogger logger=null;
  +/** Our list of deployed web applications. */
  +private Vector applications=new Vector();
  +/** The unique ID of this connector instance. */
  +protected int uniqueId=-1;
   
  -/** Our debug flag status (Used to compile out debugging information). */
  -private static final boolean DEBUG=WarpDebug.DEBUG;
  -/** The descriptive information related to this implementation. */
  -private static final String info="WarpConnector/"+WarpConstants.VERSION;
  +/*  */
  +/* Bean variables */
   
  -//  LOCAL VARIABLES
  -
  -/** The lifecycle event support for this component. */
  -private LifecycleSupport lifecycle=null;
  -/** The server socket factory for this connector. */
  -private ServerSocket socket=null;
  -/** Wether the start() method was called or not. */
  -private boolean started=false;
  -/** The accept count for the server socket. */
  -private int count = 10;
  -/** Should we enable DNS lookups? */
  -private boolean enableLookups = false;
  -
  -// 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2001-05-09 Thread craigmcc

craigmcc01/05/09 16:42:19

  Modified:catalina/src/conf server.xml
   catalina/src/share/org/apache/catalina Connector.java
   catalina/src/share/org/apache/catalina/authenticator
AuthenticatorBase.java
   catalina/src/share/org/apache/catalina/connector/http
HttpConnector.java
   catalina/src/share/org/apache/catalina/connector/http10
HttpConnector.java
   catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  [Servlet 2.3 PFD2, Section 12.8]
  
  If a request is being processed on a non-SSL connection, and is subject to
  a  that includes a transport guarantee requiring SSL,
  automatically redirect the request to a configurable port number (attached
  to the same Tomcat instance) that is listening on SSL.
  
  PR: BugTRAQ #4410795
  
  Revision  ChangesPath
  1.25  +2 -2  jakarta-tomcat-4.0/catalina/src/conf/server.xml
  
  Index: server.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/server.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- server.xml2001/05/08 05:58:43 1.24
  +++ server.xml2001/05/09 23:42:04 1.25
  @@ -51,7 +51,7 @@
   
   
   
  @@ -81,7 +81,7 @@
   
   
  
  
  
  1.5   +20 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java
  
  Index: Connector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Connector.java2001/05/08 05:58:43 1.4
  +++ Connector.java2001/05/09 23:42:07 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v 
1.4 2001/05/08 05:58:43 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/05/08 05:58:43 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v 
1.5 2001/05/09 23:42:07 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/05/09 23:42:07 $
*
* 
*
  @@ -117,7 +117,7 @@
* normative.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/05/08 05:58:43 $
  + * @version $Revision: 1.5 $ $Date: 2001/05/09 23:42:07 $
*/
   
   public interface Connector {
  @@ -174,6 +174,22 @@
* Return descriptive information about this Connector implementation.
*/
   public String getInfo();
  +
  +
  +/**
  + * Return the port number to which a request should be redirected if
  + * it comes in on a non-SSL port and is subject to a security constraint
  + * with a transport guarantee that requires SSL.
  + */
  +public int getRedirectPort();
  +
  +
  +/**
  + * Set the redirect port number.
  + *
  + * @param redirectPort The redirect port number (non-SSL to SSL)
  + */
  +public void setRedirectPort(int redirectPort);
   
   
   /**
  
  
  
  1.11  +98 -32
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java
  
  Index: AuthenticatorBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AuthenticatorBase.java2001/03/30 21:38:47 1.10
  +++ AuthenticatorBase.java2001/05/09 23:42:10 1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
 1.10 2001/03/30 21:38:47 craigmcc Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/03/30 21:38:47 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
 1.11 2001/05/09 23:42:10 craigmcc Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/05/09 23:42:10 $
*
* 
*
  @@ -66,6 +66,8 @@
   
   
   import java.io.IOException;
  +import java.net.MalformedURLException;
  +import java.net.URL;
   import java.security.MessageDigest;
   import java.security.NoSuchAlgorithmException;
   import java.security.Principal;
  @@ -118,7 +120,7 @@
* requests.  Requests of any other type will simply be passed through.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2001/03/30 21:38:47 $
  + * @version $Revision: 1.11 $ $Date: 2001/05/09 23:42:10 $
*/
   
   
  @@ -168,7 +170,7 @@

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2001-05-07 Thread craigmcc

craigmcc01/05/07 22:58:44

  Modified:catalina/docs/config http11.html
   catalina/src/conf server.xml
   catalina/src/share/org/apache/catalina Connector.java
   catalina/src/share/org/apache/catalina/connector/http
HttpConnector.java HttpRequestImpl.java
   catalina/src/share/org/apache/catalina/connector/http10
HttpConnector.java HttpRequestImpl.java
   catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  Avoid confusing users with a double negative, by changing disableLookups
  to enableLookups instead.  The default in the example config file is still
  to have lookups enabled, because that is what new Tomcat users expect, but
  it is easy to turn this off.
  
  Submitted by: Roy Fielding <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.5   +2 -2  jakarta-tomcat-4.0/catalina/docs/config/http11.html
  
  Index: http11.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/config/http11.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- http11.html   2001/05/08 03:42:21 1.4
  +++ http11.html   2001/05/08 05:58:43 1.5
  @@ -106,9 +106,9 @@
 
   
 
  -disableLookups
  +enableLookups
   
  -  Set this attribute to true to disable DNS lookups of the
  +  Set this attribute to true to enable DNS lookups of the
 remote host name when request.getRemoteHost() is called.
 If lookups are disabled, the remote IP address (as a String) is
 returned instead.  By default, DNS lookups are enabled.
  
  
  
  1.24  +11 -4 jakarta-tomcat-4.0/catalina/src/conf/server.xml
  
  Index: server.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/server.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- server.xml2001/05/08 04:12:38 1.23
  +++ server.xml2001/05/08 05:58:43 1.24
  @@ -40,12 +40,18 @@
* Execute: keytool -genkey -alias tomcat -keyalg RSA
  with a password value of "changeit".
   
  + By default, DNS lookups are enabled when a web application calls
  + request.getRemoteHost().  This can have an adverse impact on
  + performance, so you can disable it by setting the
  + "enableLookups" attribute to "false".  When DNS lookups are disabled,
  + request.getRemoteHost() will return the String version of the
  + IP address of the remote client.
   -->
   
   
   
   
  @@ -54,7 +60,7 @@
   
  @@ -74,7 +81,7 @@
   
   
  @@ -301,7 +308,7 @@
   
   
   
   
  
  
  
  1.4   +9 -9  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java
  
  Index: Connector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Connector.java2001/05/08 03:37:02 1.3
  +++ Connector.java2001/05/08 05:58:43 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v 
1.3 2001/05/08 03:37:02 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/05/08 03:37:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v 
1.4 2001/05/08 05:58:43 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/05/08 05:58:43 $
*
* 
*
  @@ -117,7 +117,7 @@
* normative.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/05/08 03:37:02 $
  + * @version $Revision: 1.4 $ $Date: 2001/05/08 05:58:43 $
*/
   
   public interface Connector {
  @@ -143,17 +143,17 @@
   
   
   /**
  - * Return the "disable DNS lookups" flag.
  + * Return the "enable DNS lookups" flag.
*/
  -public boolean getDisableLookups();
  +public boolean getEnableLookups();
   
   
   /**
  - * Set the "disable DNS lookups" flag.
  + * Set the "enable DNS lookups" flag.
*
  - * @param disableLookups The new "disable DNS lookups" flag value
  + * @param enableLookups The new "enable DNS lookups" flag value
*/
  -public void setDisableLookups(boolean disableLookups);
  +public void setEnableLookups(boolean enableLookups);
   
   
   /**
  
  
  
  1.14  +13 -13
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ==

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2001-05-07 Thread craigmcc

craigmcc01/05/07 21:12:41

  Modified:catalina build.xml
   catalina/src/conf server.xml
   catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  Re-enable compiling and starting the Java side of the warp connector.
  
  Revision  ChangesPath
  1.38  +1 -4  jakarta-tomcat-4.0/catalina/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- build.xml 2001/04/27 00:33:59 1.37
  +++ build.xml 2001/05/08 04:12:37 1.38
  @@ -106,7 +106,6 @@

classpath="${parser.jar}:${jaxp.jar}:${regexp.jar}:${servlet.jar}:${jcert.jar}:${jnet.jar}:${jsse.jar}:${jmxri.jar}"
deprecation="off" debug="on" optimize="off" target="1.2"
excludes="**/CVS/**">
  -  
 
 
  -
 
   
   
  @@ -280,7 +277,7 @@
   
  -
   
  
  
  
  1.23  +1 -14 jakarta-tomcat-4.0/catalina/src/conf/server.xml
  
  Index: server.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/server.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- server.xml2001/05/08 03:37:01 1.22
  +++ server.xml2001/05/08 04:12:38 1.23
  @@ -297,40 +297,27 @@
   
   
 
  -
   
  -
   
   
  -
   
 
  -
   
 
  -
   
  -
   
  -
   
   
  
  
  
  1.9   +17 -1 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
  
  Index: WarpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WarpConnector.java2001/01/24 23:10:43 1.8
  +++ WarpConnector.java2001/05/08 04:12:40 1.9
  @@ -78,7 +78,7 @@
* @author mailto:[EMAIL PROTECTED]";>Pier Fumagalli
* @author Copyright © 1999, 2000 http://www.apache.org";>The
* Apache Software Foundation.
  - * @version CVS $Id: WarpConnector.java,v 1.8 2001/01/24 23:10:43 pier Exp $
  + * @version CVS $Id: WarpConnector.java,v 1.9 2001/05/08 04:12:40 craigmcc Exp $
*/
   public class WarpConnector implements Connector, Lifecycle, Runnable {
   
  @@ -99,6 +99,8 @@
   private boolean started=false;
   /** The accept count for the server socket. */
   private int count = 10;
  +/** Should we disable DNS lookups? */
  +private boolean disableLookups = false;
   
   //  BEAN PROPERTIES
   
  @@ -308,6 +310,20 @@
   else this.debug("Setting container "+container.getInfo());
   }
   this.container=container;
  +}
  +
  +/**
  + * Return the "disable DNS lookups" flag for this Connector.
  + */
  +public boolean getDisableLookups() {
  +return (this.disableLookups);
  +}
  +
  +/**
  + * Set the "disable DNS lookups" flag for this Connector.
  + */
  +public void setDisableLookups(boolean disableLookups) {
  +this.disableLookups = disableLookups;
   }
   
   /**
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java

2000-12-08 Thread pier

pier00/12/08 01:42:49

  Modified:catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
  Log:
  Host mapping must not be done at Connector level but at Engine level.
  
  Revision  ChangesPath
  1.5   +1 -40 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
  
  Index: WarpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WarpConnector.java2000/12/08 02:57:05 1.4
  +++ WarpConnector.java2000/12/08 09:42:49 1.5
  @@ -78,7 +78,7 @@
* @author mailto:[EMAIL PROTECTED]">Pier Fumagalli
* @author Copyright © 1999, 2000 http://www.apache.org">The
* Apache Software Foundation.
  - * @version CVS $Id: WarpConnector.java,v 1.4 2000/12/08 02:57:05 pier Exp $
  + * @version CVS $Id: WarpConnector.java,v 1.5 2000/12/08 09:42:49 pier Exp $
*/
   public class WarpConnector implements Connector, Lifecycle, Runnable {
   
  @@ -114,10 +114,6 @@
   private int port=8008;
   /** The number of concurrent connections we can handle. */
   private int acceptcount=10;
  -/** The root path for web applications. */
  -private String appbase="";
  -/** The current Host ID. */
  -private int hostid=0;
   
   //  CONSTRUCTOR
   
  @@ -176,22 +172,6 @@
   }
   
   /**
  - * Set up a virtual host in our Engine and return the associated host ID.
  - */
  -public int setupHost(String name) {
  -WarpHost host=new WarpHost();
  -int id=this.hostid++;
  -
  -host.setName(name);
  -host.setAppBase(this.getAppBase());
  -host.setHostID(id);
  -
  -this.getContainer().addChild(host);
  -
  -return(id);
  -}
  -
  -/**
* Begin processing requests via this Connector.
*/
   public void start() throws LifecycleException {
  @@ -385,25 +365,6 @@
   public void setAcceptCount(int acceptcount) {
   if (DEBUG) this.debug("Setting accept count to "+acceptcount);
   this.acceptcount=acceptcount;
  -}
  -
  -/**
  - * Return the application root for this Connector. This can be an absolute
  - * pathname, a relative pathname, or a URL.
  - */
  -public String getAppBase() {
  -return (this.appbase);
  -}
  -
  -/**
  - * Set the application root for this Connector. This can be an absolute
  - * pathname, a relative pathname, or a URL.
  - */
  -public void setAppBase(String appbase) {
  -if (appbase==null) return;
  -if (DEBUG) this.debug("Setting application root to "+appbase);
  -String old=this.appbase;
  -this.appbase=appbase;
   }
   
   // -- LOGGING AND DEBUGGING METHODS
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpConnector.java WarpEngine.java WarpEngineMapper.java WarpEngineValve.java WarpConnection.java WarpConnectionHandler.java WarpConstants.java WarpDebug.java WarpHandler.java WarpRequestHandler.java

2000-12-07 Thread pier

pier00/12/07 09:25:33

  Modified:catalina/src/share/org/apache/catalina/connector/warp
WarpConnection.java WarpConnectionHandler.java
WarpConstants.java WarpDebug.java WarpHandler.java
WarpRequestHandler.java
  Added:   catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java WarpEngine.java
WarpEngineMapper.java WarpEngineValve.java
  Log:
  Catalina/Warp integration stage 1:
  - Added all required Catalina Engine classes (those are nedeed to auto
configure Catalina from what's specified in the web server configuration)
  - Modified all Warp classes to follow Catalina's Lifecycle design pattern
  
  Revision  ChangesPath
  1.3   +132 -46   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnection.java
  
  Index: WarpConnection.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarpConnection.java   2000/11/30 21:59:29 1.2
  +++ WarpConnection.java   2000/12/07 17:25:31 1.3
  @@ -58,33 +58,61 @@
   
   import java.io.*;
   import java.net.*;
  +import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.LifecycleEvent;
  +import org.apache.catalina.LifecycleException;
  +import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.util.LifecycleSupport;
   
   /**
*
  - *
* @author mailto:[EMAIL PROTECTED]">Pier Fumagalli
* @author Copyright © 1999, 2000 http://www.apache.org">The
* Apache Software Foundation.
  - * @version CVS $Id: WarpConnection.java,v 1.2 2000/11/30 21:59:29 pier Exp $
  + * @version CVS $Id: WarpConnection.java,v 1.3 2000/12/07 17:25:31 pier Exp $
*/
  -public class WarpConnection implements Runnable {
  +public class WarpConnection implements Lifecycle, Runnable {
  +
  +// -- CONSTANTS
   
  -/** The DEBUG flag, to compile out debugging informations. */
  -private static final boolean DEBUG = WarpConstants.DEBUG;
  +/** Our debug flag status (Used to compile out debugging information). */
  +private static final boolean DEBUG=WarpDebug.DEBUG;
   
  -private WarpHandlerTable table;
  -private Socket socket;
  -private String name;
  +//  LOCAL VARIABLES
  +
  +/** The lifecycle event support for this component. */
  +private LifecycleSupport lifecycle=null;
  +/** The WarpHandlerTable contains the list of all current handlers. */
  +private WarpHandlerTable table=null;
  +/** The name of this connection. */
  +private String name=null;
  +/** Wether we started or not. */
  +private boolean started=false;
   
  +//  BEAN PROPERTIES
  +
  +/** The socket used in this connection. */
  +private Socket socket=null;
  +/** The connector wich created this connection. */
  +private WarpConnector connector=null;
  +
  +//  CONSTRUCTOR
  +
  +/**
  + * Create a new WarpConnection instance.
  + */
   public WarpConnection() {
   super();
  +this.lifecycle=new LifecycleSupport(this);
   this.table=new WarpHandlerTable();
  -this.socket=null;
  -this.name=null;
  +if (DEBUG) this.debug("New instance created");
   }
   
  +// - PUBLIC METHODS
  +
   /**
  - *
  + * Run the thread waiting on the socket, reading packets from the client
  + * and dispatching them to the appropriate handler.
*/
   public void run() {
   WarpHandler han=null;
  @@ -98,14 +126,14 @@
   byte buf[]=null;
   
   // Log the connection opening
  -this.log("Connection opened");
  +if (DEBUG) this.debug("Connection started");
   
   try {
   // Open the socket InputStream
   in=this.socket.getInputStream();
   
   // Read packets
  -while(true) {
  +while(this.started) {
   // RID number
   b1=in.read();
   b2=in.read();
  @@ -126,14 +154,14 @@
   b1=in.read();
   b2=in.read();
   if ((b1 | b2)==-1) {
  -this.log("Premature LENGTH end");
  +this.log("Premature LEN end");
   break;
   }