costin      00/11/02 13:27:09

  Modified:    src/share/org/apache/tomcat/core Context.java
  Log:
  More work on defining Context "state".
  
  Call directly the container to get the interceptors.
  
  Revision  Changes    Path
  1.126     +31 -12    jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- Context.java      2000/10/01 22:21:44     1.125
  +++ Context.java      2000/11/02 21:27:07     1.126
  @@ -128,18 +128,29 @@
        */
       public static final String ATTRIB_REAL_CONTEXT="org.apache.tomcat.context";
   
  -    /** Context is new, not even added to server. ContextManager is not
  -     set, and most of the paths are not fixed
  +    /** Context is new, possibly not even added to server.
  +     ContextManager is not set, and most of the paths are not fixed
       */
  -    public static final int STATE_PRE_ADD=0;
  -    /** Context was added to the server. Relative paths are fixed, based
  -     on server base, and CM is set.
  +    public static final int STATE_NEW=0;
  +
  +    /** Context was added to the server, but contextInit() is not
  +     called. Paths are not set yet, the only valid information is
  +     the contextURI.
  +     */
  +    public static final int STATE_ADDED=1;
  +    
  +    /**
  +       Relative paths are fixed, based
  +       on server base, and CM is set.
  +       If a request arives for this context, an error message should be
  +       displayed ( "application is temporary disabled" )
        */
  -    public static final int STATE_ADD=1;
  +    public static final int STATE_DISABLED=2;
  +
       /** Context is initialized and ready to serve. We have all mappings
        and configs from web.xml.
       */
  -    public static final int STATE_INIT=2;
  +    public static final int STATE_READY=3;
       
       // -------------------- internal properties
       // context "id"
  @@ -151,7 +162,7 @@
       // Absolute path to docBase if file-system based
       private String absPath;
   
  -    private int state=STATE_PRE_ADD;
  +    private int state=STATE_NEW;
       
       // internal state / related objects
       private ContextManager contextM;
  @@ -300,7 +311,7 @@
        map.setPath( path );
   
        // Notify interceptors that a new container is added
  -     BaseInterceptor cI[]=contextM.getInterceptors(map);
  +     BaseInterceptor cI[]=map.getInterceptors();
        for( int i=0; i< cI.length; i++ ) {
            cI[i].addContainer( map );
        }
  @@ -347,7 +358,7 @@
            //contextM.addSecurityConstraint( this, path[i], ct);
   
            // Notify interceptors that a new container is added
  -         BaseInterceptor cI[]=contextM.getInterceptors(ct);
  +         BaseInterceptor cI[]=ct.getInterceptors();
            for( int j=0; j< cI.length; j++ ) {
                cI[j].addContainer( ct );
            }
  @@ -457,6 +468,14 @@
       public final int getState() {
        return state;
       }
  +
  +    /** Move the context in a different state.
  +     Can be called only from tomcat.core.ContextManager.
  +     ( package access )
  +    */
  +    void setState( int state ) {
  +     this.state=state;
  +    }
       
       // -------------------- Basic properties --------------------
   
  @@ -786,7 +805,7 @@
        containers.remove(ct.getPath());
   
        // notify modules that a container was removed
  -     BaseInterceptor cI[]=contextM.getInterceptors(ct);
  +     BaseInterceptor cI[]=ct.getInterceptors();
        for( int i=0; i< cI.length; i++ ) {
            cI[i].removeContainer( ct );
        }
  @@ -872,7 +891,7 @@
       */
       public final  URL[] getClassPath() {
        if( classPath==null ) return new URL[0];
  -     URL serverCP[]=contextM.getServerClassPath();
  +     URL serverCP[]=new URL[0]; //contextM.getServerClassPath();
        URL urls[]=new URL[classPath.size() + serverCP.length];
        int pos=0;
        for( int i=0; i<serverCP.length; i++ ) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to