Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 38937 invoked by uid 500); 30 Jun 2000 20:22:02 -0000 Delivered-To: apmail-jakarta-tomcat-cvs@apache.org Received: (qmail 38911 invoked by uid 1052); 30 Jun 2000 20:22:00 -0000 Date: 30 Jun 2000 20:22:00 -0000 Message-ID: <20000630202200.38907.qmail@locus.apache.org> From: costin@locus.apache.org To: jakarta-tomcat-cvs@apache.org Subject: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup EmbededTomcat.java costin 00/06/30 13:21:56 Modified: src/j2ee/org/apache/tomcat/j2ee J2EEInterceptor.java src/share/org/apache/jasper/runtime JspFactoryImpl.java JspWriterImpl.java PageContextImpl.java src/share/org/apache/tomcat/context DefaultCMSetter.java src/share/org/apache/tomcat/core BufferedServletOutputStream.java ContextManager.java ResponseImpl.java src/share/org/apache/tomcat/facade RequestDispatcherImpl.java ServletWriterFacade.java src/share/org/apache/tomcat/request InvokerInterceptor.java JspInterceptor.java SessionInterceptor.java src/share/org/apache/tomcat/startup EmbededTomcat.java Log: - fixed the last watchdog error ( problem was: forward needs to finish the response and close before returning, jasper writes after forward) - uncomment log() in J2EEInterceptor - less output - few more ( commented out ) debugging println ( used to find the bug, need to convert them to log() ) - resetBuffer will also flush the writer buffer. - in WriterFacde, add a static final boolean to disable the accounting. It can be turned on for development and tuning. - add the servlet before adding the mapping in InvokerInterceptor ( and avoid a warning ) - replaced log() with if(debug) log() in (unused yet) JspInterceptor - removed duplicated debug in SessionInterceptor - all debug set to 0 in EmbededTomcat ( again, less verbosity by default ) Revision Changes Path 1.2 +3 -3 jakarta-tomcat/src/j2ee/org/apache/tomcat/j2ee/J2EEInterceptor.java Index: J2EEInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/j2ee/J2EEInterceptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEInterceptor.java 2000/06/27 22:24:33 1.1 +++ J2EEInterceptor.java 2000/06/30 20:20:57 1.2 @@ -88,9 +88,9 @@ invM.postServletInvoke( ctx.getFacade(), sw.getServlet(), request.getFacade(), response.getFacade() ); -// intLogRequest( request.getContext().getPath(), -// request.getRequestURI(), -// null); + intLogRequest( request.getContext().getPath(), + request.getRequestURI(), + null); } catch(Exception ex ) { return -1; } 1.4 +6 -4 jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java Index: JspFactoryImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JspFactoryImpl.java 2000/06/10 01:41:19 1.3 +++ JspFactoryImpl.java 2000/06/30 20:21:02 1.4 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v 1.3 2000/06/10 01:41:19 costin Exp $ - * $Revision: 1.3 $ - * $Date: 2000/06/10 01:41:19 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v 1.4 2000/06/30 20:21:02 costin Exp $ + * $Revision: 1.4 $ + * $Date: 2000/06/30 20:21:02 $ * * ==================================================================== * @@ -95,6 +95,7 @@ pc = new PageContextImpl(this); } + // System.out.println("JspFactoryImpl.getPC" + pc); pc.initialize(servlet, request, response, errorPageURL, needsSession, bufferSize, autoflush); @@ -108,8 +109,9 @@ public void releasePageContext(PageContext pc) { pc.release(); - if( usePool) + if( usePool) { pool.put( pc ); + } } static class SunJspEngineInfo extends JspEngineInfo { 1.4 +6 -4 jakarta-tomcat/src/share/org/apache/jasper/runtime/JspWriterImpl.java Index: JspWriterImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspWriterImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JspWriterImpl.java 2000/05/24 01:58:13 1.3 +++ JspWriterImpl.java 2000/06/30 20:21:03 1.4 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspWriterImpl.java,v 1.3 2000/05/24 01:58:13 costin Exp $ - * $Revision: 1.3 $ - * $Date: 2000/05/24 01:58:13 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspWriterImpl.java,v 1.4 2000/06/30 20:21:03 costin Exp $ + * $Revision: 1.4 $ + * $Date: 2000/06/30 20:21:03 $ * * ==================================================================== * @@ -162,8 +162,10 @@ } protected void initOut() throws IOException { - if (out == null) + if (out == null) { out = response.getWriter(); + //System.out.println("JspWriterImpl: initOut: " + this + " " +out); + } } 1.13 +4 -3 jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java Index: PageContextImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PageContextImpl.java 2000/06/19 20:13:57 1.12 +++ PageContextImpl.java 2000/06/30 20:21:04 1.13 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v 1.12 2000/06/19 20:13:57 costin Exp $ - * $Revision: 1.12 $ - * $Date: 2000/06/19 20:13:57 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v 1.13 2000/06/30 20:21:04 costin Exp $ + * $Revision: 1.13 $ + * $Date: 2000/06/30 20:21:04 $ * * ==================================================================== * @@ -178,6 +178,7 @@ throw new IllegalStateException("Page needs a session and none is available"); // initialize the initial out ... + // System.out.println("Initialize PageContextImpl " + out ); if( out == null ) { out = _createOut(bufferSize, autoFlush); // throws } else 1.45 +1 -1 jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java Index: DefaultCMSetter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- DefaultCMSetter.java 2000/06/23 02:16:16 1.44 +++ DefaultCMSetter.java 2000/06/30 20:21:11 1.45 @@ -343,7 +343,7 @@ location = makeAbsolute(req, location); - ctx.log("Redirect " + location + " " + req ); + if( debug>0) ctx.log("Redirect " + location + " " + req ); res.setContentType("text/html"); // ISO-8859-1 default res.setHeader("Location", location); 1.14 +4 -3 jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java Index: BufferedServletOutputStream.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- BufferedServletOutputStream.java 2000/06/22 19:49:32 1.13 +++ BufferedServletOutputStream.java 2000/06/30 20:21:19 1.14 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v 1.13 2000/06/22 19:49:32 costin Exp $ - * $Revision: 1.13 $ - * $Date: 2000/06/22 19:49:32 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v 1.14 2000/06/30 20:21:19 costin Exp $ + * $Revision: 1.14 $ + * $Date: 2000/06/30 20:21:19 $ * * ==================================================================== * @@ -299,6 +299,7 @@ // Reset the buffer. bufferCount = 0; totalCount = 0; + // System.out.println("Reset buffer "); } /** Reuse the object instance, avoid GC 1.100 +3 -2 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.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- ContextManager.java 2000/06/28 15:42:54 1.99 +++ ContextManager.java 2000/06/30 20:21:24 1.100 @@ -930,13 +930,14 @@ Context ctx = req.getContext(); if(ctx==null) ctx=getContext(""); - ctx.log( "Status Handler: " + code + " req=" + req); + ctx.log( code + " " + req + " " + + req.getAttribute("javax.servlet.error.message")); errorPath = ctx.getErrorPage( code ); if( errorPath != null ) { errorServlet=getHandlerForPath( ctx, errorPath ); } - if( debug>-1 ) + if( debug>0 ) ctx.log( "Handler " + errorServlet + " " + errorPath); if( errorServlet==null ) 1.33 +5 -3 jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java Index: ResponseImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- ResponseImpl.java 2000/06/26 21:59:30 1.32 +++ ResponseImpl.java 2000/06/30 20:21:25 1.33 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.32 2000/06/26 21:59:30 costin Exp $ - * $Revision: 1.32 $ - * $Date: 2000/06/26 21:59:30 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.33 2000/06/30 20:21:25 costin Exp $ + * $Revision: 1.33 $ + * $Date: 2000/06/30 20:21:25 $ * * ==================================================================== * @@ -389,6 +389,8 @@ // Reset the response buffer but not headers and cookies public void resetBuffer() throws IllegalStateException { + if( usingWriter && writer != null ) + writer.flush(); out.reset(); // May throw IllegalStateException 1.8 +4 -0 jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- RequestDispatcherImpl.java 2000/06/22 00:15:02 1.7 +++ RequestDispatcherImpl.java 2000/06/30 20:21:33 1.8 @@ -189,6 +189,10 @@ // CM should have set the wrapper - call it ServletWrapper wr=realRequest.getWrapper(); if( wr!=null ) wr.service(realRequest, realResponse); + + // close the response - output after this point will be discarded. + realResponse.finish(); + } public void include(ServletRequest request, ServletResponse response) 1.3 +11 -10 jakarta-tomcat/src/share/org/apache/tomcat/facade/ServletWriterFacade.java Index: ServletWriterFacade.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/ServletWriterFacade.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ServletWriterFacade.java 2000/05/30 06:16:47 1.2 +++ ServletWriterFacade.java 2000/06/30 20:21:34 1.3 @@ -81,6 +81,7 @@ public final class ServletWriterFacade extends PrintWriter { Response resA; RequestImpl req; + static final boolean ACCT=false;// a smart compiler will remove all in/out public ServletWriterFacade( Writer w, Response resp ) { super( w ); @@ -91,33 +92,33 @@ // -------------------- Write methods -------------------- public void flush() { - in(); + if( ACCT ) in(); super.flush(); - out(); + if( ACCT ) out(); } public void print( String str ) { - in(); + if( ACCT ) in(); super.print( str ); - out(); + if( ACCT ) out(); } public void println( String str ) { - in(); + if( ACCT ) in(); super.println( str ); - out(); + if( ACCT ) out(); } public void write( char buf[], int offset, int count ) { - in(); + if( ACCT ) in(); super.write( buf, offset, count ); - out(); + if( ACCT ) out(); } public void write( String str ) { - in(); + if( ACCT ) in(); super.write( str ); - out(); + if( ACCT ) out(); } private void in() { 1.4 +1 -1 jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java Index: InvokerInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InvokerInterceptor.java 2000/06/28 20:37:07 1.3 +++ InvokerInterceptor.java 2000/06/30 20:21:38 1.4 @@ -150,9 +150,9 @@ // it's a much cleaner way to construct the servlet and // make sure all interceptors are up to date. try { + wrapper = ctx.addServlet( servletName, servletName ); ctx.addServletMapping( newServletPath + "/*" , servletName ); - wrapper = ctx.getServletByName( servletName); wrapper.setOrigin( ServletWrapper.ORIGIN_INVOKER ); if( debug > 0) log( "Added mapping " + wrapper + 1.3 +21 -20 jakarta-tomcat/src/share/org/apache/tomcat/request/JspInterceptor.java Index: JspInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/JspInterceptor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JspInterceptor.java 2000/06/28 18:33:31 1.2 +++ JspInterceptor.java 2000/06/30 20:21:41 1.3 @@ -102,7 +102,8 @@ { Servlet theServlet = sw.getServlet(); if (theServlet instanceof HttpJspBase) { - log( "PreServletInit: HttpJspBase.setParentClassLoader" + sw ); + if( debug > 0 ) + log( "PreServletInit: HttpJspBase.setParentClassLoader" + sw ); HttpJspBase h = (HttpJspBase) theServlet; h.setClassLoader(ctx.getServletLoader().getClassLoader()); } @@ -123,7 +124,7 @@ // If this Wrapper was already used, we have all the info JspInfo jspInfo=(JspInfo)wrapper.getNote( jspInfoNOTE ); if( jspInfo == null ) { - log("New jsp page - no jspInfo "); + if( debug > 0 ) log("New jsp page - no jspInfo "); jspInfo=new JspInfo(req); mapJspPage( req, jspInfo, jspInfo.uri, jspInfo.fullClassN); } @@ -177,13 +178,13 @@ return ; } req.setWrapper( wrapper ); - log("Wrapper " + wrapper); + if( debug>0) log("Wrapper " + wrapper); } /** Convert the .jsp file to a java file, then compile it to class */ void compile(Request req, JspInfo jspInfo ) { - log( "Compiling "); + log( "Compiling " + jspInfo.realClassPath); try { // make sure we have the directories File dir=new File( jspInfo.outputDir + "/" + jspInfo.pkgDir); @@ -206,7 +207,7 @@ javac( createJavaCompiler( options ), ctxt, mangler ); - log( "Compiled to " + jspInfo.realClassPath ); + if(debug>0)log( "Compiled to " + jspInfo.realClassPath ); jspInfo.touch(); } catch( Exception ex ) { ex.printStackTrace(); @@ -229,7 +230,7 @@ String cp=System.getProperty("java.class.path")+ sep + ctxt.getClassPath() + sep + ctxt.getOutputDir(); javac.setClasspath( cp ); - log( "ClassPath " + cp); + if( debug>0) log( "ClassPath " + cp); ByteArrayOutputStream out = new ByteArrayOutputStream (256); javac.setOutputDir(ctxt.getOutputDir()); @@ -348,10 +349,10 @@ classN + ".java"; fullClassN = pkg +"." + classN; - System.out.println("ClassN=" + classN + - " realClassPath=" + realClassPath + - " javaFilePath=" + javaFilePath + - " fullClassN =" + fullClassN); +// System.out.println("ClassN=" + classN + +// " realClassPath=" + realClassPath + +// " javaFilePath=" + javaFilePath + +// " fullClassN =" + fullClassN); writeVersion(); // save to mapFile } @@ -406,14 +407,14 @@ updateVersionedPaths(); } - System.out.println("uri=" + uri + - //" outputDir=" + outputDir + - //" jspSource=" + jspSource + - " pkgDir=" + pkgDir + - " baseClassN=" + baseClassN + - " ext=" + ext + - " mapPath=" + mapPath + - " version=" + version); +// System.out.println("uri=" + uri + +// //" outputDir=" + outputDir + +// //" jspSource=" + jspSource + +// " pkgDir=" + pkgDir + +// " baseClassN=" + baseClassN + +// " ext=" + ext + +// " mapPath=" + mapPath + +// " version=" + version); } @@ -428,7 +429,7 @@ try { FileInputStream fis=new FileInputStream( mapFile ); version=(int)fis.read(); - System.out.println("Version=" + version ); +// System.out.println("Version=" + version ); fis.close(); } catch( Exception ex ) { ex.printStackTrace(); @@ -445,7 +446,7 @@ try { FileOutputStream fis=new FileOutputStream( mapFile ); fis.write(version); - System.out.println("WVersion=" + version ); +// System.out.println("WVersion=" + version ); fis.close(); } catch( Exception ex ) { ex.printStackTrace(); 1.24 +0 -6 jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java Index: SessionInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- SessionInterceptor.java 2000/06/23 02:16:21 1.23 +++ SessionInterceptor.java 2000/06/30 20:21:41 1.24 @@ -81,17 +81,11 @@ // GS, separates the session id from the jvm route static final char SESSIONID_ROUTE_SEP = '.'; - int debug=0; ContextManager cm; public SessionInterceptor() { } - public void setDebug( int i ) { - System.out.println("Set debug to " + i); - debug=i; - } - public void setContextManager( ContextManager cm ) { this.cm=cm; } 1.12 +3 -3 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- EmbededTomcat.java 2000/06/27 22:29:50 1.11 +++ EmbededTomcat.java 2000/06/30 20:21:48 1.12 @@ -169,7 +169,7 @@ /** Remove a context */ public void removeContext( ServletContext sctx ) { - if(debug>-1) log( "remove context " + sctx ); + if(debug>0) log( "remove context " + sctx ); try { if( facadeM==null ) { System.out.println("XXX ERROR: no facade manager"); @@ -188,7 +188,7 @@ to the context. */ public void addClassPath( ServletContext context, String cpath ) { - if(debug>-1) log( "addClassPath " + context.getRealPath("") + " " + + if(debug>0) log( "addClassPath " + context.getRealPath("") + " " + cpath ); try { @@ -363,7 +363,7 @@ // access control ( find if a resource have constraints ) AccessInterceptor accessI=new AccessInterceptor(); addRequestInterceptor( accessI ); - accessI.setDebug(20); + accessI.setDebug(0); // set context class loader Jdk12Interceptor jdk12I=new Jdk12Interceptor();