costin 2002/06/20 16:00:43 Modified: jasper2/src/share/org/apache/jasper/compiler TldLocationsCache.java Log: Added some code to allow the caching of the TldLibraryInfo. On apps with many pages and many taglibs it is a waste of time to read/parse the same tld on every page. Revision Changes Path 1.4 +25 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java Index: TldLocationsCache.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TldLocationsCache.java 5 Jun 2002 23:18:33 -0000 1.3 +++ TldLocationsCache.java 20 Jun 2002 23:00:43 -0000 1.4 @@ -130,20 +130,30 @@ */ private Hashtable mappings = new Hashtable(); + private Hashtable tlds = new Hashtable(); + + private boolean initialized=false; + ServletContext ctxt; //********************************************************************* // Constructor and Initilizations - + public TldLocationsCache(ServletContext ctxt) { + this.ctxt=ctxt; + } + + private void init() { + if( initialized ) return; try { processWebDotXml(ctxt); processJars(ctxt); + initialized=true; } catch (JasperException ex) { Constants.message("jsp.error.internal.tldinit", new Object[] { ex.getMessage() }, Logger.ERROR); } } - + private void processWebDotXml(ServletContext ctxt) throws JasperException { @@ -305,6 +315,7 @@ public String[] getLocation(String uri) throws JasperException { + if( ! initialized ) init(); return (String[])mappings.get(uri); } @@ -327,6 +338,18 @@ } } + public TagLibraryInfo getTagLibraryInfo( String uri ) { + if( ! initialized ) init(); + Object o=tlds.get( uri ); + if( o==null ) return null; + return (TagLibraryInfo)o; + } + + public void addTagLibraryInfo( String uri, TagLibraryInfo tld ) { + if( ! initialized ) init(); + tlds.put( uri, tld); + } + private void p(String s) { System.out.println("[TldLocationsCache] " + s); }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>