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 JkServlet.java JniMain.java
Date Wed, 06 Feb 2002 18:23:25 GMT
costin      02/02/06 10:23:25

  Modified:    jk/java/org/apache/jk/server JkServlet.java JniMain.java
  Log:
  Update for the API and JkMain changes.
  
  Revision  Changes    Path
  1.6       +33 -23    jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkServlet.java
  
  Index: JkServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JkServlet.java	26 Jan 2002 17:25:20 -0000	1.5
  +++ JkServlet.java	6 Feb 2002 18:23:25 -0000	1.6
  @@ -90,21 +90,6 @@
       public JkServlet()
       {
       }
  -
  -    protected void servletConfig2properties(JkMain jk, ServletConfig conf )
  -    {
  -        if( conf==null ) {
  -            d("No servlet config ");
  -            return;
  -        }
  -        Enumeration paramNE=conf.getInitParameterNames();
  -        while( paramNE.hasMoreElements() ){
  -            String s=(String)paramNE.nextElement();
  -            String v=conf.getInitParameter(s);
  -
  -            jk.setProperty( s, v );
  -        }
  -    }
       
       public void init(ServletConfig conf) throws ServletException {
           try {
  @@ -121,7 +106,8 @@
          way to access tomcat40 internals without implementing the interface,
          and that will brake 3.3 ( and probably other things ).
   
  -       It does seem to work for 4.0, and in future we can add a tomcat40 valve/whatever
  +       It does seem to work for 4.0, and in future we can add a tomcat40
  +       valve/whatever
          that will provide an Attribute for 'trusted' apps with pointer to
          the internals.
       */
  @@ -133,7 +119,13 @@
       private void try33() {
           // 33 ?
           try {
  -            JkServlet t33=(JkServlet)newInstance( "org.apache.jk.server.tomcat33.JkServlet33"
);
  +            Object o=newInstance( "org.apache.tomcat.core.Context" );
  +            if( o==null ) {
  +                d("3.3 not detected or untrusted app");
  +                return;
  +            }
  +            JkServlet t33=
  +     (JkServlet)newInstance( "org.apache.jk.server.tomcat33.JkServlet33" );
               if( t33 == null ) {
                   d("3.3 not detected or untrusted app");
                   return;
  @@ -171,18 +163,19 @@
           }
       }
   
  -    protected JkMain jkMain;
  +    protected JkMain jkMain=new JkMain();
       
  -    protected void initJkMain(ServletConfig cfg, Worker defaultWorker) {
  -        jkMain=new JkMain();
  +    protected void initJkMain(ServletConfig cfg, JkHandler defaultWorker) {
           servletConfig2properties( jkMain, cfg );
  -        jkMain.setDefaultWorker( defaultWorker );
  +
  +        jkMain.getWorkerEnv().addHandler("container", defaultWorker );
   
           String jkHome=cfg.getServletContext().getRealPath("/");
           d("Setting jkHome " + jkHome );
  -        jkMain.setJkHome( jkHome );
  +        jkMain.setJkHome( jkHome + "/WEB-INF" );
                           
           try {
  +            jkMain.init();
               jkMain.start();
           } catch( Exception ex ) {
               ex.printStackTrace();
  @@ -203,7 +196,24 @@
       }
   
   
  -    private static final int dL=0;
  +    /** Set jk main properties using the servlet config file
  +     */
  +    private void servletConfig2properties(JkMain jk, ServletConfig conf )
  +    {
  +        if( conf==null ) {
  +            d("No servlet config ");
  +            return;
  +        }
  +        Enumeration paramNE=conf.getInitParameterNames();
  +        while( paramNE.hasMoreElements() ){
  +            String s=(String)paramNE.nextElement();
  +            String v=conf.getInitParameter(s);
  +
  +            jk.setProperty( s, v );
  +        }
  +    }
  +
  +    private static final int dL=10;
       private static void d(String s ) {
           System.err.println( "JkServlet: " + s );
       }
  
  
  
  1.2       +4 -4      jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JniMain.java
  
  Index: JniMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JniMain.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JniMain.java	26 Jan 2002 17:21:41 -0000	1.1
  +++ JniMain.java	6 Feb 2002 18:23:25 -0000	1.2
  @@ -123,12 +123,12 @@
   
               wEnv=new WorkerEnv();
               ChannelJni cjni=new ChannelJni();
  -            wEnv.addChannel( "jni", cjni );
  -            Worker defaultWorker=new WorkerDummy();
  +            wEnv.addHandler( "jni", cjni );
  +            JkHandler defaultWorker=new WorkerDummy();
               
               HandlerRequest hReq=new HandlerRequest();
  -            wEnv.addHandler( hReq );
  -            hReq.setWorker( defaultWorker );
  +            wEnv.addHandler( "req", hReq );
  +            hReq.setNext( defaultWorker );
               
               wEnv.start();
   
  
  
  

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