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 68780 invoked by uid 500); 30 Sep 2000 04:43:31 -0000 Delivered-To: apmail-jakarta-tomcat-cvs@apache.org Received: (qmail 68773 invoked by uid 1052); 30 Sep 2000 04:43:30 -0000 Date: 30 Sep 2000 04:43:30 -0000 Message-ID: <20000930044330.68771.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/request ReloadInterceptor.java costin 00/09/29 21:43:30 Modified: src/facade22/org/apache/tomcat/facade WebXmlReader.java src/share/org/apache/tomcat/context LoaderInterceptor11.java LoaderInterceptor12.java PolicyInterceptor.java src/share/org/apache/tomcat/core ContextManager.java src/share/org/apache/tomcat/request ReloadInterceptor.java Log: Removed ContextManager.getAbsolute() and a lot of absolute calls. Instead of calling cm.getAbsoulte( context.getBase() ) it's easier to just use context.getAbsolutePath() - and avoid few dozens redundant operation ( that don't matter as performance, but they are still redundant) Revision Changes Path 1.4 +2 -2 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java Index: WebXmlReader.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- WebXmlReader.java 2000/09/30 04:03:33 1.3 +++ WebXmlReader.java 2000/09/30 04:43:28 1.4 @@ -103,8 +103,8 @@ // default should be inside // readDefaultWebXml( ctx ); - File inf_xml = cm.getAbsolute( new File(ctx.getDocBase() + - "/WEB-INF/web.xml")); + File inf_xml = new File(ctx.getAbsolutePath() + + "/WEB-INF/web.xml"); if( inf_xml.exists() ) processWebXmlFile(ctx, inf_xml.getPath() ); 1.7 +3 -5 jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor11.java Index: LoaderInterceptor11.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor11.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- LoaderInterceptor11.java 2000/09/29 21:09:21 1.6 +++ LoaderInterceptor11.java 2000/09/30 04:43:28 1.7 @@ -83,14 +83,13 @@ public void addContext( ContextManager cm, Context context) throws TomcatException { - String base = context.getDocBase(); + String base = context.getAbsolutePath(); // Add "WEB-INF/classes" File dir = new File(base + "/WEB-INF/classes"); // GS, Fix for the jar@lib directory problem. // Thanks for Kevin Jones for providing the fix. - dir = cm.getAbsolute(dir); if( dir.exists() ) { try { URL url=new URL( "file", null, dir.getAbsolutePath() + "/" ); @@ -99,14 +98,13 @@ } } - File f = cm.getAbsolute(new File(base + "/WEB-INF/lib")); + File f = new File(base + "/WEB-INF/lib"); Vector jars = new Vector(); getJars(jars, f); for(int i=0; i < jars.size(); ++i) { String jarfile = (String) jars.elementAt(i); - File jarF=new File(f, jarfile ); - File jf=cm.getAbsolute( jarF ); + File jf=new File(f, jarfile ); String absPath=jf.getAbsolutePath(); try { URL url=new URL( "file", null, absPath ); 1.5 +3 -5 jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor12.java Index: LoaderInterceptor12.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor12.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LoaderInterceptor12.java 2000/09/29 21:09:25 1.4 +++ LoaderInterceptor12.java 2000/09/30 04:43:28 1.5 @@ -93,14 +93,13 @@ throws TomcatException { if( debug>0) log( "Add context " + context.getPath()); - String base = context.getDocBase(); + String base = context.getAbsolutePath(); // Add "WEB-INF/classes" File dir = new File(base + "/WEB-INF/classes"); // GS, Fix for the jar@lib directory problem. // Thanks for Kevin Jones for providing the fix. - dir = cm.getAbsolute(dir); if( dir.exists() ) { try { URL url=new URL( "file", null, dir.getAbsolutePath() + "/" ); @@ -109,14 +108,13 @@ } } - File f = cm.getAbsolute(new File(base + "/WEB-INF/lib")); + File f = new File(base + "/WEB-INF/lib"); Vector jars = new Vector(); getJars(jars, f); for(int i=0; i < jars.size(); ++i) { String jarfile = (String) jars.elementAt(i); - File jarF=new File(f, jarfile ); - File jf=cm.getAbsolute( jarF ); + File jf=new File(f, jarfile ); String absPath=jf.getAbsolutePath(); try { URL url=new URL( "file", null, absPath ); 1.12 +3 -3 jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java Index: PolicyInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- PolicyInterceptor.java 2000/09/29 07:00:56 1.11 +++ PolicyInterceptor.java 2000/09/30 04:43:28 1.12 @@ -103,7 +103,7 @@ if( null == System.getProperty("java.security.policy")) { if( policyFile==null ) { // XXX ugly API - change CM - File f=cm.getAbsolute(new File("conf/tomcat.policy")); + File f= new File(cm.getHome(), "conf/tomcat.policy"); policyFile=f.getPath(); } log("Setting policy file to " + policyFile); @@ -147,10 +147,10 @@ throws TomcatException { ContextManager cm = context.getContextManager(); - String base = context.getDocBase(); + String base = context.getAbsolutePath(); try { - File dir = cm.getAbsolute(new File(base)); + File dir = new File(base); URL url = new URL("file:" + dir.getAbsolutePath()); CodeSource cs = new CodeSource(url,null); 1.139 +2 -28 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.138 retrieving revision 1.139 diff -u -r1.138 -r1.139 --- ContextManager.java 2000/09/30 04:03:43 1.138 +++ ContextManager.java 2000/09/30 04:43:29 1.139 @@ -1142,8 +1142,7 @@ if( path!=null ) { File f=new File( path ); if( ! f.isAbsolute() ) { - // Make it relative to home ! - File wd= getAbsolute( f ); + File wd= new File(getHome(), f.getPath()); l.setPath( wd.getAbsolutePath() ); } // create the files, ready to log. @@ -1375,17 +1374,8 @@ return getInstallDir(); } - /** Convert a relative name to absolute by using the "home" property + /** Default container */ - public File getAbsolute(File f) { - if (!f.isAbsolute()) { - // evaluate repository path relative to the context's home - // directory - return new File(getHome(), f.getPath()); - } - return f; - } - public Container getContainer() { return defaultContainer; } @@ -1393,20 +1383,4 @@ public void setContainer(Container newDefaultContainer) { defaultContainer = newDefaultContainer; } - - - // Do we need that ? - - // /** Map the context facade back to the context. - // This call doesn't involve any security checks, and - // can be used by internal components ( they - // already have access to ContextManager ). - // Servlets need to call getAttribute(), and that - // will do the required security checks - // */ - // public Context getRealContext( Object facade ) { - // return null; - // } - - } 1.6 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/request/ReloadInterceptor.java Index: ReloadInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/ReloadInterceptor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ReloadInterceptor.java 2000/09/30 04:03:45 1.5 +++ ReloadInterceptor.java 2000/09/30 04:43:30 1.6 @@ -103,8 +103,8 @@ context.setDependManager( dm ); } - File inf_xml = cm.getAbsolute( new File(context.getDocBase() + - "/WEB-INF/web.xml")); + File inf_xml = new File(context.getAbsolutePath() + + "/WEB-INF/web.xml"); if( inf_xml.exists() ) { Dependency dep=new Dependency(); dep.setTarget("web.xml");