tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40 JkConfig40.java JkConnector.java JkRequest40.java JkResponse40.java Worker40.java
Date Wed, 06 Feb 2002 17:52:28 GMT
costin      02/02/06 09:52:28

  Modified:    jk/java/org/apache/jk/server/tomcat40 JkConfig40.java
                        JkConnector.java JkRequest40.java JkResponse40.java
                        Worker40.java
  Log:
  Updates for the 4.x adapter. It should work fine ( except config, that wasn't
  ported )
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkConfig40.java
  
  Index: JkConfig40.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkConfig40.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JkConfig40.java	12 Jan 2002 04:14:53 -0000	1.1
  +++ JkConfig40.java	6 Feb 2002 17:52:27 -0000	1.2
  @@ -303,7 +303,7 @@
   	return false;
       }
   
  -    private static final int dL=10;
  +    private static final int dL=0;
       private static void d(String s ) {
           System.err.println( "JkConfig40: " + s );
       }
  
  
  
  1.5       +2 -2      jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkConnector.java
  
  Index: JkConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkConnector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JkConnector.java	26 Jan 2002 17:29:13 -0000	1.4
  +++ JkConnector.java	6 Feb 2002 17:52:27 -0000	1.5
  @@ -202,11 +202,11 @@
           ((ContainerBase)ct).addLifecycleListener(config);
           config.loadExisting( ct );
   
  -        jkMain.setDefaultWorker( worker );
  +        jkMain.getWorkerEnv().addHandler("container", worker );
   
           String catalinaHome=System.getProperty("catalina.home");
           File f=new File( catalinaHome );
  -        File jkHomeF=new File( f, "webapps/jk" );
  +        File jkHomeF=new File( f, "webapps/jk/WEB-INF" );
           
           d("Setting jkHome " + jkHomeF );
           jkMain.setJkHome( jkHomeF.getAbsolutePath() );
  
  
  
  1.3       +3 -48     jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkRequest40.java
  
  Index: JkRequest40.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkRequest40.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JkRequest40.java	26 Jan 2002 17:25:21 -0000	1.2
  +++ JkRequest40.java	6 Feb 2002 17:52:27 -0000	1.3
  @@ -78,6 +78,7 @@
   import org.apache.tomcat.util.http.MimeHeaders;
   
   import org.apache.jk.core.*;
  +import org.apache.jk.server.*;
   import org.apache.jk.common.*;
   import org.apache.jk.util.*;
   
  @@ -89,7 +90,7 @@
   
       private static int id = 1;
       Channel ch;
  -    Endpoint ep;
  +    MsgContext ep;
       
       public JkRequest40() {
           super();
  @@ -102,7 +103,7 @@
           response=res;
       }
       
  -    public void setEndpoint( Channel ch, Endpoint ep ) {
  +    public void setEndpoint( Channel ch, MsgContext ep ) {
           this.ch=ch;
           this.ep=ep;
       }
  @@ -258,50 +259,4 @@
           return getName();
       }
   
  -}
  -
  -class JkInputStream extends InputStream {
  -
  -    JkInputStream() {
  -    }
  -
  -    public int available() throws IOException {
  -        return 0;
  -    }
  -
  -    public void close() throws IOException {
  -    }
  -
  -    public void mark(int readLimit) {
  -    }
  -
  -    public boolean markSupported() {
  -        return false;
  -    }
  -
  -    public void reset() throws IOException {
  -        throw new IOException("reset() not supported");
  -    }
  -
  -    byte singleRead[]=new byte[1];
  -    
  -    public int read() throws IOException {
  -        int rc=read( singleRead, 0, 1 );
  -        if( rc== 1 )
  -            return singleRead[0];
  -        return -1;
  -    }
  -
  -    public int read(byte[] b, int off, int len) throws IOException {
  -        return -1;// ajp13.doRead(b, off, len);
  -    }
  -
  -    public long skip(long n) throws IOException {
  -        if (n > Integer.MAX_VALUE) {
  -            throw new IOException("can't skip than many:  " + n);
  -        }
  -        // XXX if n is big, split this in multiple reads
  -        byte[] b = new byte[(int)n];
  -        return read(b, 0, b.length);
  -    }
   }
  
  
  
  1.3       +2 -2      jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkResponse40.java
  
  Index: JkResponse40.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/JkResponse40.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JkResponse40.java	26 Jan 2002 17:25:21 -0000	1.2
  +++ JkResponse40.java	6 Feb 2002 17:52:27 -0000	1.3
  @@ -82,7 +82,7 @@
       private MimeHeaders headers = new MimeHeaders();
       private StringBuffer cookieValue = new StringBuffer();
       Channel ch;
  -    Endpoint ep;
  +    MsgContext ep;
       int headersMsgNote;
       int utfC2bNote;
       
  @@ -260,7 +260,7 @@
           ch.send( msg, ep );
        }
   
  -    void setEndpoint(Channel ch, Endpoint ep) {
  +    void setEndpoint(Channel ch, MsgContext ep) {
           this.ch=ch;
           this.ep=ep;
           MsgAjp msg=(MsgAjp)ep.getNote( headersMsgNote );
  
  
  
  1.4       +9 -143    jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/Worker40.java
  
  Index: Worker40.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/tomcat40/Worker40.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Worker40.java	25 Jan 2002 15:14:41 -0000	1.3
  +++ Worker40.java	6 Feb 2002 17:52:27 -0000	1.4
  @@ -75,7 +75,7 @@
   /** Tomcat 40 worker
    *
    */
  -public class Worker40 extends Worker
  +public class Worker40 extends JkHandler
   {
       private int reqNote;
       Container container;
  @@ -89,21 +89,23 @@
           this.container=ct40;
       }
   
  -    public void init(WorkerEnv we) throws IOException {
  -        reqNote=we.getNoteId( WorkerEnv.REQUEST_NOTE, "tomcat40Request" );
  +    public void init() throws IOException {
  +        reqNote=wEnv.getNoteId( WorkerEnv.REQUEST_NOTE, "tomcat40Request" );
       }
       
  -    public void service( BaseRequest req, Channel ch, Endpoint ep )
  +    public int invoke( Msg msg, MsgContext ep )
           throws IOException
       {
           d("Incoming request " );
  -                
  +
  +        BaseRequest req=ep.getRequest();
  +        Channel ch=ep.getChannel();
           JkRequest40 treq=(JkRequest40)req.getNote( reqNote );
           JkResponse40  tres;
           if( treq==null ) {
               treq=new JkRequest40();
               req.setNote( reqNote, treq );
  -            tres=new JkResponse40(we);
  +            tres=new JkResponse40(wEnv);
               treq.setResponse( tres );
               tres.setRequest( treq );
           }
  @@ -123,147 +125,11 @@
   
           treq.recycle();
           tres.recycle();
  +        return OK;
       }
   
       private static final int dL=0;
       private static void d(String s ) {
           System.err.println( "Worker40: " + s );
       }
  -
  -    
  -    // -------------------- Handler implementation --------------------
  -
  -//     /** Construct the request object, with probably unnecesary
  -// 	sanity tests ( should work without thread pool - but that is
  -// 	not supported in PoolTcpConnector, maybe in future )
  -//     */
  -//     private Ajp14Request initRequest(Object thData[] ) {
  -// 	if( ajp14_note < 0 ) throw new RuntimeException( "assert: ajp14_note>0" );
  -// 	Ajp14Request req=null;
  -// 	if( thData != null ) {
  -// 	    req=(Ajp14Request)thData[0];
  -// 	}
  -// 	if( req != null ) {
  -// 	    Response res=req.getResponse();
  -// 	    req.recycle();
  -// 	    res.recycle();
  -// 	    // make the note available to other modules
  -// 	    req.setNote( ajp14_note, req.ajp13);
  -// 	    return req;
  -// 	}
  -// 	// either thData==null or broken ( req==null)
  -//        	Ajp13 ajp13=new Ajp13(reqHandler);
  -//         negHandler.init( ajp13 );
  -
  -// 	negHandler.setContainerSignature( ContextManager.TOMCAT_NAME +
  -//                                           " v" + ContextManager.TOMCAT_VERSION);
  -// 	if( password!= null ) {
  -//             negHandler.setPassword( password );
  -//             ajp13.setBackward(false); 
  -//         }
  -
  -// 	BaseRequest ajpreq=new BaseRequest();
  -
  -// 	req=new Ajp14Request(ajp13, ajpreq);
  -// 	Ajp14Response res=new Ajp14Response(ajp13);
  -// 	cm.initRequest(req, res);
  -// 	return  req;
  -//     }
  -    
  -//     /** Called whenever a new TCP connection is received. The connection
  -// 	is reused.
  -//      */
  -//     public void processConnection(TcpConnection connection, Object thData[])
  -//     {
  -//         try {
  -// 	    if( debug>0)
  -// 		log( "Received ajp14 connection ");
  -//             Socket socket = connection.getSocket();
  -// 	    // assert: socket!=null, connection!=null ( checked by PoolTcpEndpoint )
  -	    
  -//             socket.setSoLinger( true, 100);
  -
  -//             Ajp14Request req=initRequest( thData );
  -//             Ajp14Response res= (Ajp14Response)req.getResponse();
  -//             Ajp13 ajp13=req.ajp13;
  -// 	    BaseRequest ajpReq=req.ajpReq;
  -
  -//             ajp13.setSocket(socket);
  -
  -// 	    // first request should be the loginit.
  -// 	    int status=ajp13.receiveNextRequest( ajpReq );
  -// 	    if( status != 304 )  { // XXX use better codes
  -// 		log( "Failure in logInit ");
  -// 		return;
  -// 	    }
  -
  -// 	    status=ajp13.receiveNextRequest( ajpReq );
  -// 	    if( status != 304 ) { // XXX use better codes
  -// 		log( "Failure in login ");
  -// 		return;
  -// 	    }
  -	    
  -//             boolean moreRequests = true;
  -//             while(moreRequests) {
  -// 		status=ajp13.receiveNextRequest( ajpReq );
  -
  -// 		if( status==-2) {
  -// 		    // special case - shutdown
  -// 		    // XXX need better communication, refactor it
  -// 		    if( !doShutdown(socket.getLocalAddress(),
  -// 				    socket.getInetAddress())) {
  -// 			moreRequests = false;
  -// 			continue;
  -// 		    }                        
  -// 		}
  -		
  -// 		if( status  == 200)
  -// 		    cm.service(req, res);
  -// 		else if (status == 500) {
  -// 		    log( "Invalid request received " + req );
  -// 		    break;
  -// 		}
  -		
  -// 		req.recycle();
  -// 		res.recycle();
  -//             }
  -//             if( debug > 0 ) log("Closing ajp14 connection");
  -//             ajp13.close();
  -// 	    socket.close();
  -//         } catch (Exception e) {
  -// 	    log("Processing connection " + connection, e);
  -//         }
  -//     }
  -
  -//     // We don't need to check isSameAddress if we authenticate !!!
  -//     protected boolean doShutdown(InetAddress serverAddr,
  -//                                  InetAddress clientAddr)
  -//     {
  -//         try {
  -// 	    // close the socket connection before handling any signal
  -// 	    // but get the addresses first so they are not corrupted			
  -//             if(isSameAddress(serverAddr, clientAddr)) {
  -// 		cm.stop();
  -// 		// same behavior as in past, because it seems that
  -// 		// stopping everything doesn't work - need to figure
  -// 		// out what happens with the threads ( XXX )
  -
  -// 		// XXX It should work now - but will fail if servlets create
  -// 		// threads
  -// 		System.exit(0);
  -// 	    }
  -// 	} catch(Exception ignored) {
  -// 	    log("Ignored " + ignored);
  -// 	}
  -// 	log("Shutdown command ignored");
  -// 	return false;
  -//     }
  -
  -//     // legacy, should be removed 
  -//     public void setServer(Object contextM)
  -//     {
  -//         this.cm=(ContextManager)contextM;
  -//     }
  -    
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message