costin      01/09/22 15:03:47

  Modified:    src/share/org/apache/tomcat/core ContextManager.java
               src/share/org/apache/tomcat/startup EmbededTomcat.java
  Log:
  Fixes from Johannes Brodwall <[EMAIL PROTECTED]> on EmbededTomcat and
  message for non-initialized contexts.
  
  Revision  Changes    Path
  1.194     +6 -5      
jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- ContextManager.java       2001/09/10 06:43:01     1.193
  +++ ContextManager.java       2001/09/22 22:03:47     1.194
  @@ -946,14 +946,15 @@
        }
        req.setState(Request.STATE_CONTEXT_MAPPED );
   
  -     if( req.getContext() == null ||
  -         req.getContext().getState() != Context.STATE_READY ) {
  +     if( req.getContext() == null) {
  +         req.setAttribute("javax.servlet.error.message",
  +                          "No context found");
  +     }
  +     if( req.getContext().getState() != Context.STATE_READY ) {
            // the context is not fully initialized.
            req.setAttribute("javax.servlet.error.message",
  -                          "Application not available");
  +                          "Context " + req.getContext() + " not ready");
            // return error code - the caller will handle it
  -         // handleStatus( req, req.getResponse(), 503 );
  -         // service unavailable
            return 503;
        }
        
  
  
  
  1.57      +5 -1      
jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- EmbededTomcat.java        2001/09/20 03:44:06     1.56
  +++ EmbededTomcat.java        2001/09/22 22:03:47     1.57
  @@ -317,6 +317,9 @@
       public Context addContext(  String ctxPath, URL docRoot, String hosts[] )
        throws TomcatException
       {
  +     if( "ROOT".equals( ctxPath ) ) {
  +         ctxPath="";
  +     }
        if(dL>0)
            debug( "add context \"" + hosts[0] + ":" + ctxPath + "\" "+
                   docRoot );
  @@ -345,6 +348,7 @@
            }
   
            contextM.addContext( ctx );
  +         ctx.init();
            return ctx;
        } catch( Exception ex ) {
            debug("exception adding context " + ctxPath + "/" + docRoot, ex);
  @@ -494,7 +498,7 @@
   
        setModuleProperty( mid, "port", Integer.toString( port )) ;
        if( addr != null )
  -         setModuleProperty( mid, "address", addr.toString());
  +         setModuleProperty( mid, "address", addr.getHostAddress());
        if( hostname != null )
            setModuleProperty( mid, "hostName",  hostname );
        return mid;
  
  
  

Reply via email to