> Has someone a working example of an ITemplateSourceDelegate
> or or a PageSpecificationResolverImpl ? I can't find any.
> I only want to have a .class for each page and in the same
> package the html template. All .page configuration will be
> set using annotations.
> Thanks !!
>
Here is ISpecificationResolverDelegate which I use in my project. It allows
me to
1. get rid of *.page files. Ionly need MyPage.html and MyPage.class
2. store both MyPage.html and MyPage.class in the same location ( in my case
it's WEB_INF\classes\com\Mycompany\page\ )
3. use getPage( "com.mycompany.MyPage" )
4. get rid of <meta key="org.apache.tapestry.page-class-packages" > in my
.application file
Hope this helps.
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.LocationImpl;
import org.apache.tapestry.INamespace;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.resolver.ISpecificationResolverDelegate;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
public class SpecificationResolverDelegate implements
ISpecificationResolverDelegate {
public IComponentSpecification findPageSpecification(IRequestCycle
cycle, INamespace namespace, String simplePageName){
final Resource namespaceLocation =
namespace.getSpecificationLocation();
final Resource templateResource =
namespaceLocation.getRelativeResource( "classes/" + simplePageName.replace(
'.', '/' ) + ".html" );
if ( templateResource.getResourceURL() != null ){
final Resource pageResource =
namespaceLocation.getRelativeResource( "classes/" + simplePageName.replace(
'.', '/' ) + ".page" );
final IComponentSpecification specification = new
ComponentSpecification();
specification.setComponentClassName( simplePageName
);
specification.setPageSpecification( false );
specification.setSpecificationLocation( pageResource
);
specification.setLocation( new LocationImpl(
templateResource ) );
return specification;
}
return null;
}
public IComponentSpecification findComponentSpecification(
IRequestCycle cycle, INamespace namespace, String type){
return null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]