Re: Tapestry 5.1.0.5 to 5.2.6 migration. .html templates
Sorry for posting this in the wrong list. I solved this by decorating ComponentTemplateLocator. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-0-5-to-5-2-6-migration-html-templates-tp5713624p5713769.html Sent from the Tapestry - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org
Re: Tapestry 5.1.0.5 to 5.2.6 migration. .html templates
Firstly, this question should be on the user's list (not the dev list). To change template lookup behaviour, you will need to either override or (more likely) decorate the ComponentResourceLocator. http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/services/pageload/ComponentResourceLocator.html http://tapestry.apache.org/tapestry-ioc-decorators.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-0-5-to-5-2-6-migration-html-templates-tp5713624p5713716.html Sent from the Tapestry - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org
Re: Tapestry 5.1.0.5 to 5.2.6 migration. .html templates
I've found that the problem seems to be that ComponentTemplateSourceImpl fails to load MyTemplateLocator.class and insteads load DefaultTemplateLocator/PageTemplateLocator which looks for tml pages in the correct directory, where MyTemplateLocator looks for html pages. How do I override this behavoir in 5.2.6, a behavoir that worked in 5.1.0.5. locator.locateTemplate fails here. private Resource locateTemplateResource(ComponentModel initialModel, Locale locale) { ComponentModel model = initialModel; while (model != null) { Resource localized = locator.locateTemplate(model, locale); if (localized != null) return localized; // Otherwise, this component doesn't have its own template ... lets work up to its // base class and check there. model = model.getParentModel(); } // This will be a Resource whose URL is null, which will be picked up later and force the // return of the empty template. return initialModel.getBaseResource().withExtension(TapestryConstants.TEMPLATE_EXTENSION); } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-0-5-to-5-2-6-migration-html-templates-tp5713624p5713695.html Sent from the Tapestry - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org
Tapestry 5.1.0.5 to 5.2.6 migration. .html templates
Hi, I'm migrating the tapestry framework of an application from 5.1.0.5 to 5.2.6 and I'm running into problems with locating the .html templates that hold the .tml components. public class MyTemplateLocator implements PageTemplateLocator { private final ComponentClassResolver resolver; public MyTemplateLocator (ComponentClassResolver resolver) { this.resolver = resolver; } public Resource findPageTemplateResource(ComponentModel model, Locale locale) { String className = model.getComponentClassName(); if(!className.contains(.pages.)) return null; String logicalName = _resolver.resolvePageClassNameToPageName(className); int slashx = logicalName.lastIndexOf('/'); if(slashx 0) { String simpleClassName = InternalUtils.lastTerm(className); logicalName = logicalName.substring(0, slashx + 1) + simpleClassName; } String path = format(pages/%s.%s, logicalName, html); return new ClasspathResource(path); } } public class TweaksModule public MyTemplateLocator buildMyPageLocator (ComponentClassResolver componentClassResolver) { return new MyTemplateLocator (componentClassResolver); } public static void contributeAliasOverrides(@InjectService(MyPageLocator) PageTemplateLocator, ConfigurationAliasContributionlt;PageTemplateLocator configuration) { configuration.add(AliasContribution.create(PageTemplateLocator.class, locator)); } This code works fine in 5.1.0.5 but after switching to 5.2.6, PageTemplateLocator is moved, and no longer an interface, so I instead implement the interface that it is now implementing in my own locator. But I get an error; Page ws/Start did not generate any markup when rendered. This could be because its template file could not be located, or because a render phase method in the page prevented rendering. What interface behaves in 5.2.6 the same way as PageTemplateLocator did in 5.1.0.5. Thanks -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-0-5-to-5-2-6-migration-html-templates-tp5713624.html Sent from the Tapestry - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org