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 JkCoyoteHandler.java
Date Sat, 06 Apr 2002 17:02:47 GMT
costin      02/04/06 09:02:47

  Modified:    jk/java/org/apache/jk/server JkCoyoteHandler.java
  Log:
  Initial implementation for the coyote ProtocolHandler.
  
  Very early code, not working - I have to implement the callbacks.
  
  Note that all existing jk connectors will be deprecated/removed and merged
  with coyote.
  
  Revision  Changes    Path
  1.3       +46 -18    jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java
  
  Index: JkCoyoteHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JkCoyoteHandler.java	5 Apr 2002 13:37:39 -0000	1.2
  +++ JkCoyoteHandler.java	6 Apr 2002 17:02:47 -0000	1.3
  @@ -76,30 +76,15 @@
   
   /** Plugs Jk2 into Coyote
    */
  -public class JkCoyoteHandler implements ProtocolHandler
  +public class JkCoyoteHandler extends JkHandler implements ProtocolHandler, ActionHook
   {
  -    static class ResponseActionHook implements ActionHook {
  -        public void action(ActionCode actionCode, Object param) {
  -            if( actionCode==ActionCode.ACTION_COMMIT ) {
  -
  -            }
  -            if( actionCode==ActionCode.ACTION_RESET ) {
  -
  -            }
  -            if( actionCode==ActionCode.ACTION_CLOSE ) {
  -            }
  -            if( actionCode==ActionCode.ACTION_ACK ) {
  -
  -            }
  -        }
  -    }
  -
       Adapter adapter;
  +    protected JkMain jkMain=new JkMain();
       
       /** Pass config info
        */
       public void setAttribute( String name, Object value ) {
  -
  +        System.out.println("Set attribute " + name + " " + value );
       }
       
       public Object getAttribute( String name ) {
  @@ -116,16 +101,59 @@
           return adapter;
       }
   
  +    boolean started=false;
  +    
       /** Start the protocol
        */
       public void init() {
  +        if( started ) return;
   
  +        started=true;
  +        jkMain.getWorkerEnv().addHandler("container", this );
  +
  +        try {
  +            jkMain.init();
  +            jkMain.start();
  +        } catch( Exception ex ) {
  +            ex.printStackTrace();
  +        }
       }
   
       public void destroy() {
  +        //  jkMain.stop();
  +    }
  +
   
  +    // Jk Handler mehod
  +    public int invoke( Msg msg, MsgContext ep ) 
  +        throws IOException
  +    {
  +        System.out.println("XXX Invoke " );
  +        org.apache.coyote.Request req=(org.apache.coyote.Request)ep.getRequest();
  +        org.apache.coyote.Response res=req.getResponse();
  +        res.setHook( this );
  +        try {
  +            adapter.service( req, res );
  +        } catch( Exception ex ) {
  +            ex.printStackTrace();
  +        }
  +        return OK;
       }
   
  +    public void action(ActionCode actionCode, Object param) {
  +        System.out.println("XXX Action " + actionCode + " " + param );
  +        if( actionCode==ActionCode.ACTION_COMMIT ) {
  +            
  +        }
  +        if( actionCode==ActionCode.ACTION_RESET ) {
  +            
  +        }
  +        if( actionCode==ActionCode.ACTION_CLOSE ) {
  +        }
  +        if( actionCode==ActionCode.ACTION_ACK ) {
  +            
  +        }
  +    }
   
   
   }
  
  
  

--
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