Here's the specification resolver code that we use:

public class AppSpecRelativeSpecificationResolverDelegate implements
                ISpecificationResolverDelegate
{
        private String templateExtension;
        
        public IComponentSpecification
findPageSpecification(IRequestCycle cycle,
                        INamespace namespace, String simplePageName)
        {
                String templateName = simplePageName +
getTemplateExtension();
                Resource namespaceLocation =
namespace.getSpecificationLocation();
                Resource templateResource =
namespaceLocation.getRelativeResource( templateName );
                if ( templateResource.getResourceURL() != null )
                {
                        return setupImplicitPage( simplePageName,
templateResource, namespaceLocation );
                }
                
                return null;
        }

        public IComponentSpecification findComponentSpecification(
                        IRequestCycle cycle, INamespace namespace,
String type)
        {
                return null;
        }

    private String getTemplateExtension( )
    {
        return templateExtension;
    }

    private IComponentSpecification setupImplicitPage(String simpleName,
Resource resource, Resource namespaceLocation)
    {
        Resource pageResource =
namespaceLocation.getRelativeResource(simpleName + ".page");

        IComponentSpecification specification = new
ComponentSpecification();
        specification.setPageSpecification(true);
        specification.setSpecificationLocation(pageResource);
        specification.setLocation(new LocationImpl(resource));

        return specification;
    }

    public void setTemplateExtension(String extension)
    {
        if ( extension.charAt(0) != '.' )
                extension = "." + extension;
        
        templateExtension = extension;
    }
}


And here's the necessary .application file config:
<extension name="org.apache.tapestry.specification-resolver-delegate" 
        
class="com.foo.bar.AppSpecRelativeSpecificationResolverDelegate">
        <configure property="templateExtension" value=".html"/>
</extension>

Hope this helps,
jeff

-----Original Message-----
From: Gregg Bolinger [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 13, 2006 12:32 PM
To: Tapestry users
Subject: Re: Annotations - No .page file?

Very interested.  Thanks.

Any plans for this to be configurable via HiveMind or the .application
file
in a future release?  It seems to me that you used to be able to
configure
this in versions < 4?  Am I wrong?

Gregg

On 1/13/06, Jeff Lubetkin <[EMAIL PROTECTED]> wrote:
>
> We had the same problem, and used an ISpecificationResolverDelegate to
> move everything to WEB-INF.  It's pretty straightforward, but I can
> share code if you're interested.
>
> jeff
>
> -----Original Message-----
> From: Gregg Bolinger [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 13, 2006 12:19 PM
> To: Tapestry users
> Subject: Re: Annotations - No .page file?
>
> Ok, that worked, however, that also allows direct access to my
templates
> on
> the URL.  I'll need to look into being able to put the template files
> elsewhere.  Thanks for the help.
>
> Gregg
>
> On 1/13/06, Jeff Lubetkin <[EMAIL PROTECTED]> wrote:
> >
> > Just realized I miswrote :P
> >
> > Tapestry searches relative to servlet context for the template.
Move
> > your Home.html up to the root of the servlet...should work.
> >
> > jeff
> >
> > -----Original Message-----
> > From: Gregg Bolinger [mailto:[EMAIL PROTECTED]
> > Sent: Friday, January 13, 2006 12:04 PM
> > To: Tapestry users
> > Subject: Re: Annotations - No .page file?
> >
> > My Home.html is under WEB-INF along side my reverse.application
file.
> >
> > On 1/13/06, Jeff Lubetkin <[EMAIL PROTECTED]> wrote:
> > >
> > > Without a page file, Tapestry will search relative to the
> application
> > > spec for the template.  Is it possible that your template is under
> > > WEB-INF or something like that?  If so, move it to the same
> directory
> > as
> > > your .application file.
> > >
> > > jeff
> > >
> > > -----Original Message-----
> > > From: Gregg Bolinger [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, January 13, 2006 11:57 AM
> > > To: Tapestry users
> > > Subject: Re: Annotations - No .page file?
> > >
> > > Yep, here is what I have.
> > >
> > > reverse.application
> > >
> > > <?xml version="1.0"?>
> > > <!DOCTYPE application PUBLIC
> > > "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
> > > "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
> > > <application>
> > >     <meta key="org.apache.tapestry.page-class-packages" value="
> > > com.gthought.pages"/>
> > > </application>
> > >
> > > And my Home.class is package com.gthought.pages.Home;
> > >
> > > web.xml is
> > >
> > > <servlet>
> > >             <description>Application Servlet for
> > Tapestry</description>
> > >             <servlet-name>reverse</servlet-name>
> > >             <servlet-class>org.apache.tapestry.ApplicationServlet
> > > </servlet-class>
> > >             <load-on-startup>1</load-on-startup>
> > >         </servlet>
> > >
> > >         <servlet-mapping>
> > >             <servlet-name>reverse</servlet-name>
> > >             <url-pattern>/app</url-pattern>
> > >         </servlet-mapping>
> > >
> > >
> > >
> > >
> > > On 1/13/06, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Can Tapestry locate your Home class; did you configure it with
the
> > > > corrent package(s) to search?
> > org.apache.tapestry.page-class-packages
> > > >
> > > > On 1/13/06, Gregg Bolinger <[EMAIL PROTECTED]> wrote:
> > > > > I am trying to get a good feel for replacing as much in the
> .page
> > > file
> > > > using
> > > > > annotations.  I have a very simple page and I have used
> > annotations
> > > for
> > > > the
> > > > > Form and the TextField.  I tried removing the .page file
> > completely,
> > > > > assuming it was no longer needed, but I got an exception:
> > > > >
> > > > > Page 'Home' not found in application namespace.
> > > > >
> > > > > My question is what can I do, if anything, to lose the .page
> file
> > > > > completely?  Or do I have to have one no matter what, just
> empty.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Gregg
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Howard M. Lewis Ship
> > > > Independent J2EE / Open-Source Java Consultant
> > > > Creator, Jakarta Tapestry
> > > > Creator, Jakarta HiveMind
> > > >
> > > > Professional Tapestry training, mentoring, support
> > > > and project work.  http://howardlewisship.com
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >
> > >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
[EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to