/** * This method is currently synchronized, because {@link org.apache.tapestry.parse.TemplateParser} is not threadsafe. * Another good candidate for a pooling mechanism, especially because parsing a template may * take a while. */ private synchronized ComponentTemplate constructTemplateInstance(IRequestCycle cycle, char[] templateData, Resource resource, IComponent component) { String componentAttributeName = _componentPropertySource.getComponentProperty( component, "org.apache.tapestry.jwcid-attribute-name"); ITemplateParserDelegate delegate = new DefaultParserDelegate(component, componentAttributeName, cycle, _componentSpecificationResolver); TemplateToken[] tokens; try { tokens = _parser.parse(templateData, delegate, resource); } catch (TemplateParseException ex) { throw new ApplicationRuntimeException(ImplMessages.unableToParseTemplate(resource), ex); } if (_log.isDebugEnabled()) _log.debug("Parsed " + tokens.length + " tokens from template"); return new ComponentTemplate(templateData, tokens); }
/** * This method is currently synchronized, because {@link org.apache.tapestry.parse.TemplateParser} is not threadsafe. * Another good candidate for a pooling mechanism, especially because parsing a template may * take a while. */ private synchronized ComponentTemplate constructTemplateInstance(IRequestCycle cycle, char[] templateData, Resource resource, IComponent component) { String componentAttributeName = _componentPropertySource.getComponentProperty( component, "org.apache.tapestry.jwcid-attribute-name"); ITemplateParserDelegate delegate = new DefaultParserDelegate(component, componentAttributeName, cycle, _componentSpecificationResolver); TemplateToken[] tokens; try { tokens = _parser.parse(templateData, delegate, resource); } catch (TemplateParseException ex) { throw new ApplicationRuntimeException(ImplMessages.unableToParseTemplate(resource), ex); } if (_log.isDebugEnabled()) _log.debug("Parsed " + tokens.length + " tokens from template"); return new ComponentTemplate(templateData, tokens); }