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/12/31 20:09:59 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/server JkMain.java JkServlet.java

costin      01/12/31 11:09:59

  Added:       jk/java/org/apache/jk/server JkMain.java JkServlet.java
  Log:
  JkServlet will be the main entry point into Jk2. It'll use the normal
  web.xml to get the config data, do initial config and call a
  second servlet, specific to each container.
  
  The container-specific servlet will use specific methods to access the
  containers internals ( attribute for 3.3, extend internal servlet in 4.x).
  It should work like the other 'special' servlets ( the admin in 3.3,
  manager in 4.x ).
  
  It seems the 4.0 problem can be resolved by just copying the
  jars in lib/server ( while keeping the 'trusted' webapp ). In 4.1
  or 3.3 it should work as any other 'trusted' webapp.
  
  I haven't played yet with the new manager, but any deploy tool that
  supports web.xml editing should be useable to configure jk.
  
  JkMain is used to test the current code.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java
  
  Index: JkMain.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.jk.server;
  
  import java.io.*;
  import java.net.*;
  import java.util.*;
  
  import org.apache.jk.core.*;
  import org.apache.jk.common.*;
  
  import org.apache.tomcat.util.net.*;
  import org.apache.tomcat.util.buf.*;
  import org.apache.tomcat.util.http.*;
  
  /** Main class used for testing jk core and common code and tunning.
   *
   *  It'll just start/init jk and use a dummy endpoint ( i.e. no servlet
   *  container ).
   */
  public class JkMain
  {
      WorkerEnv wEnv=new WorkerEnv();
      
      public JkMain()
      {
      }
      
  
      public void start() throws IOException {
          ChannelSocket csocket=new ChannelSocket();
          csocket.setPort( 8009 );
          wEnv.addChannel( csocket );
  
          WorkerDummy wdummy=new WorkerDummy();
          csocket.setWorker( wdummy );
          wEnv.addWorker( wdummy );
          
          HandlerRequest hReq=new HandlerRequest();
          wEnv.addHandler( hReq );
          hReq.setWorker( wdummy );
          
          HandlerEcho hEcho=new HandlerEcho();
          wEnv.addHandler( hEcho );
          
          wEnv.start();
      }
  
  
      public static void main(String args[]) {
          try {
              if( args.length == 0 ) {
                  System.out.println("Usage: ");
                  System.out.println("  JkMain workers.properties workerId");
                  return;
              }
              
              String propFile=args[0];
              
              JkMain jkMain=new JkMain();
              jkMain.start();
          } catch( Exception ex ) {
              ex.printStackTrace();
          }
      }
  
      private static final int dL=0;
      private static void d(String s ) {
          System.err.println( "JkMain: " + s );
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkServlet.java
  
  Index: JkServlet.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.jk.server;
  
  import java.io.*;
  import java.net.*;
  import java.util.*;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  import org.apache.jk.core.*;
  import org.apache.jk.common.*;
  
  import org.apache.tomcat.util.net.*;
  import org.apache.tomcat.util.buf.*;
  import org.apache.tomcat.util.http.*;
  
  /** Main class used for testing jk core and common code and tunning.
   *
   *  It'll just start/init jk and use a dummy endpoint ( i.e. no servlet
   *  container ).
   */
  public class JkServlet
  {
      public JkServlet()
      {
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>