View | Details | Raw Unified | Return to bug 33650
Collapse All | Expand All

(-)Options.java (+20 lines)
Line 20 Link Here
20
import java.util.Map;
Line 173 Link Here
174
    /**
175
     * Indicates whether the returned TreeNode by parseXMLDocument
176
     * in TagLibraryInfoImpl.parseTLD should be cached.
177
     *
178
     * It intends to improve the precompilation performance of japser
179
     * by parsing the same TLD only once through caching. Applicable
180
     * to command-line build with Ant or Shell scripts.
181
     */
182
    public boolean isCacheTldXml();
183
    
184
    /**
185
     * The web-application wide cache for the returned TreeNode
186
     * by parseXMLDocument in TagLibraryInfoImpl.parseTLD,
187
     * if isCacheTldXml returns true.
188
     * 
189
     * @return the Map(String uri, TreeNode tld) instance.
190
     */
191
    public Map getCachedTldXmlMap();
192
    
(-)JspC.java (+39 lines)
Line 39 Link Here
39
import java.util.Map;
40
import java.util.HashMap;
Line 49 Link Here
51
import org.apache.jasper.xmlparser.TreeNode;
Line 122 Link Here
125
    private static final String SWITCH_CACHE_TLD_XML = "-cacheTldXml";
Line 206 Link Here
210
    /**
211
     * Cache for the parsed TLD XML data.
212
     * Map cachedTldXmlMap(String uri, TreeNode tld).
213
     */
214
    private boolean cacheTldXml = true;
215
    private Map cachedTldXmlMap = new HashMap();
216
Line 314 Link Here
325
            } else if (tok.equals(SWITCH_CACHE_TLD_XML)) {
326
                tok = nextArg();
327
                if ("false".equals(tok)) {
328
                    cacheTldXml = false;
329
                } else {
330
                    cacheTldXml = true;
331
                }
Line 549 Link Here
567
     * @see Options#isCacheTldXml()
568
     */
569
    public boolean isCacheTldXml() {
570
        return cacheTldXml;
571
    }
572
573
    /**
574
     * @see Options#isCacheTldXml()
575
     */
576
    public void setCacheTldXml(boolean cacheTldXml) {
577
        this.cacheTldXml = cacheTldXml;
578
    }
579
580
    /**
581
     * @see Options#getCachedTldXmlMap()
582
     */
583
    public Map getCachedTldXmlMap() {
584
        return cachedTldXmlMap;
585
    }
586
587
    /**
(-)EmbeddedServletOptions.java (+17 lines)
Line 152 Link Here
152
     * Cache for the parsed TLD XML data
153
     */
154
    private boolean cacheTldXml = false;
155
    
156
    /**
Line 334 Link Here
339
    public boolean isCacheTldXml() {
340
        return cacheTldXml;
341
    }
342
   
343
    public void setCacheTldXml(boolean cacheTldXml) {
344
        this.cacheTldXml = cacheTldXml;
345
    }
346
    
347
    public Map getCachedTldXmlMap() {
348
        return null;
349
    }
350
    
(-)TagLibraryInfoImpl.java (-3 / +14 lines)
Line 71 Link Here
71
    private Map cachedTldXmlMap;
Line 141 Link Here
142
	this.cachedTldXmlMap = ctxt.getOptions().getCachedTldXmlMap();
Line 214 Link Here
216
        TreeNode tld = null;
Lines 216-217 Link Here
216
        ParserUtils pu = new ParserUtils();
219
        if (ctxt.getServletContext() instanceof org.apache.jasper.servlet.JspCServletContext) {
217
        TreeNode tld = pu.parseXMLDocument(uri, in);
220
            if ((tld = (TreeNode) cachedTldXmlMap.get(uri)) == null) {
218
--
221
                ParserUtils pu = new ParserUtils();
222
       	        tld = pu.parseXMLDocument(uri, in);
223
                cachedTldXmlMap.put(uri, tld);
224
            }
225
        }
226
        else {
227
            ParserUtils pu = new ParserUtils();
228
            tld = pu.parseXMLDocument(uri, in);
229
        }

Return to bug 33650