NOTE: This information applies to an older version of Tapestry. For current information on Layouts in Tapestry, see http://tapestry.apache.org//layout-component.html.

1. insert into your application hivemodule.xml

    <implementation service-id="tapestry.page.ComponentSpecificationResolver">

        <invoke-factory model="threaded">
            <construct class="de.hsofttec.core4.resolver.Core4ComponentSpecificationResolverImpl">
                <set-object property="specificationSource" value="infrastructure:specificationSource"/>
                <set-service property="delegate" service-id="tapestry.page.SpecificationResolverDelegate"/>
                <set-object property="applicationId" value="infrastructure:applicationId"/>
                <set-object property="contextRoot" value="infrastructure:contextRoot"/>
                <set-object property="classFinder" value="infrastructure:classFinder"/>
            </construct>
        </invoke-factory>

    </implementation>

2. overwrite tapestry's ComponentSpecificationResolverImpl

public class Core4ComponentSpecificationResolverImpl extends ComponentSpecificationResolverImpl
{
    public void resolve(IRequestCycle cycle, INamespace containerNamespace, String libraryId, String type, Location location)
    {
        // we detect the Border component and are sure, we dont call from the application namesspace
        if (type.equals("Border") && !containerNamespace.isApplicationNamespace())
        {
            INamespace namespace = containerNamespace;
            while (!namespace.isApplicationNamespace() && namespace != null)
                namespace = namespace.getParentNamespace();

            if (namespace != null)
                containerNamespace = namespace;
        }

        super.resolve(cycle, containerNamespace, libraryId, type, location);
    }
}

3. make more flexible

insert into your application config a meta key like "appl.border" in fill the value with the name of your border component. then retrieve the value of this meta key in the Core4ComponentSpecificationResolverImpl.

  • No labels