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...@apache.org on 2001/06/24 23:17:13 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java

costin      01/06/24 14:17:13

  Modified:    jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java
  Log:
  Fixes for the code move.
  
  One big missing chunk is the adapter between o.a.ajp.AjpRequest and
  tomcat33 request ( similar with the one for tomcat4 ).
  I'm working on this.
  
  Revision  Changes    Path
  1.3       +37 -7     jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java
  
  Index: Ajp14Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Ajp14Interceptor.java	2001/06/23 19:04:34	1.2
  +++ Ajp14Interceptor.java	2001/06/24 21:17:13	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java,v 1.2 2001/06/23 19:04:34 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/06/23 19:04:34 $
  + * $Header: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java,v 1.3 2001/06/24 21:17:13 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/06/24 21:17:13 $
    *
    * ====================================================================
    *
  @@ -66,7 +66,12 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  +
  +import org.apache.ajp.*;
  +
  +import org.apache.tomcat.modules.server.*;
   import org.apache.tomcat.core.*;
  +
   import org.apache.tomcat.util.net.*;
   import org.apache.tomcat.util.*;
   import org.apache.tomcat.util.log.*;
  @@ -90,6 +95,7 @@
       implements  TcpConnectionHandler
   {
       int ajp14_note=-1;
  +    String password;
       
       public Ajp14Interceptor()
       {
  @@ -104,6 +110,10 @@
   
       // -------------------- Ajp14 specific parameters --------------------
   
  +    public void setPassword( String s ) {
  +	log( "Password=" + s);
  +	this.password=s;
  +    }
   
       
       // -------------------- PoolTcpConnector --------------------
  @@ -154,7 +164,12 @@
   	}
   	// either thData==null or broken ( req==null)
   	Ajp14 ajp14=new Ajp14();
  -	req=new Ajp14Request(ajp14);
  +	ajp14.setContainerSignature( ContextManager.TOMCAT_NAME +
  +				     " v" + ContextManager.TOMCAT_VERSION);
  +	AjpRequest ajpreq=new AjpRequest();
  +	log( "Setting pass " + password );
  +	ajp14.setPassword( password );
  +	req=new Ajp14Request(ajp14, ajpreq);
   	Ajp14Response res=new Ajp14Response(ajp14);
   	cm.initRequest(req, res);
   	return  req;
  @@ -174,16 +189,29 @@
               Ajp14Request req=initRequest( thData );
               Ajp14Response res= (Ajp14Response)req.getResponse();
               Ajp14 ajp14=req.ajp14;
  +	    AjpRequest ajpReq=req.ajpReq;
   
               ajp14.setSocket(socket);
   
   	    if( debug>0)
   		log( "Received ajp14 connection ");
  +
  +	    // first request should be the loginit.
  +	    int status=ajp14.receiveNextRequest( ajpReq );
  +	    if( status != 304 )  { // XXX use better codes
  +		log( "Failure in logInit ");
  +		return;
  +	    }
  +
  +	    status=ajp14.receiveNextRequest( ajpReq );
  +	    if( status != 304 ) { // XXX use better codes
  +		log( "Failure in login ");
  +		return;
  +	    }
   	    
               boolean moreRequests = true;
               while(moreRequests) {
  -		// first request should be the logon.
  -		int status=ajp14.receiveNextRequest( req );
  +		status=ajp14.receiveNextRequest( ajpReq );
   
   		if( status==-2) {
   		    // special case - shutdown
  @@ -254,10 +282,12 @@
   class Ajp14Request extends Request 
   {
       Ajp14 ajp14;
  +    AjpRequest ajpReq;
       
  -    public Ajp14Request(Ajp14 ajp14) 
  +    public Ajp14Request(Ajp14 ajp14, AjpRequest ajpReq) 
       {
           this.ajp14=ajp14;
  +	this.ajpReq=ajpReq;
       }
   
       // XXX This should go away if we introduce an InputBuffer.
  
  
  

Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java

Posted by kevin seguin <se...@motive.com>.
kevin seguin wrote:
> 
> costin@apache.org wrote:
> >
> > costin      01/06/24 14:17:13
> >
> >   Modified:    jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java
> >   Log:
> >   Fixes for the code move.
> >
> >   One big missing chunk is the adapter between o.a.ajp.AjpRequest and
> >   tomcat33 request ( similar with the one for tomcat4 ).
> >   I'm working on this.
> >
> 
> hey costin,  one of the things i've been planning on doing is changing
> o.a.ajp.AjpRequest to make use of o.a.coyote.Request.  basically, wrap
> Request in AjpRequest.  does this conflict with your plans?

actually, i take that back.  i don't think i'm going to do that yet...
AjpRequest will stay as is for now (unless someone else has grander
plans :))

Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33Ajp14Interceptor.java

Posted by kevin seguin <se...@motive.com>.
cmanolache@yahoo.com wrote:
> 
> On Sun, 24 Jun 2001, kevin seguin wrote:
> 
> > hey costin,  one of the things i've been planning on doing is changing
> > o.a.ajp.AjpRequest to make use of o.a.coyote.Request.  basically, wrap
> > Request in AjpRequest.  does this conflict with your plans?
> 
> Yes, a bit, as I'm going to wrap AjpRequest in a tomcat33 Request.
> 
> Object wrapping an object wrapping an object is not that clean.
> 
> Can we just use a single base request, say "BaseRequest", have it in
> util/ ( which is shared by everything ), and then just wrap it in your
> tomcat4 Request and in the tomcat33 Request ?
> 
> If we're going to do that, I would apreciate few method name changes,
> so I can use it as a base class for core.Request. If not - I can still
> wrap it.
> 

i saw your checkin comment regarding BaseRequest.  i have no problem
with moving AjpRequest to org.apache.util.http.BaseRequest.  let's not
make it final, though, so it can be extended.  you want to do that while
you're making other changes?

> The reason I prefer
>   foo()
> instead of
>   MessageBytes getFoo()
> 
> is that the second is associated with the get/set pattern ( when in fact
> it's you need to change the modifiable result ).
> 
> I'm ok with using it, but at least please name the private fields with
> other names ( like fooMB or _foo or something else ).
> 

that's all cool with me :)

Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java

Posted by cm...@yahoo.com.
On Sun, 24 Jun 2001, kevin seguin wrote:

> hey costin,  one of the things i've been planning on doing is changing
> o.a.ajp.AjpRequest to make use of o.a.coyote.Request.  basically, wrap
> Request in AjpRequest.  does this conflict with your plans?

Yes, a bit, as I'm going to wrap AjpRequest in a tomcat33 Request. 

Object wrapping an object wrapping an object is not that clean.

Can we just use a single base request, say "BaseRequest", have it in
util/ ( which is shared by everything ), and then just wrap it in your
tomcat4 Request and in the tomcat33 Request ?

If we're going to do that, I would apreciate few method name changes,
so I can use it as a base class for core.Request. If not - I can still 
wrap it.

The reason I prefer
  foo()
instead of
  MessageBytes getFoo()  

is that the second is associated with the get/set pattern ( when in fact
it's you need to change the modifiable result ).

I'm ok with using it, but at least please name the private fields with
other names ( like fooMB or _foo or something else ).

Costin


Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java

Posted by kevin seguin <se...@motive.com>.
costin@apache.org wrote:
> 
> costin      01/06/24 14:17:13
> 
>   Modified:    jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java
>   Log:
>   Fixes for the code move.
> 
>   One big missing chunk is the adapter between o.a.ajp.AjpRequest and
>   tomcat33 request ( similar with the one for tomcat4 ).
>   I'm working on this.
> 

hey costin,  one of the things i've been planning on doing is changing
o.a.ajp.AjpRequest to make use of o.a.coyote.Request.  basically, wrap
Request in AjpRequest.  does this conflict with your plans?