You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Jérôme BERNARD <je...@gmail.com> on 2007/02/22 16:42:17 UTC

Tap5: Routing support?

Hi,

Will Tap5 support of kind of URL routing support?
What I mean is that I'd like to route/match URLs such as
http://my.wonderfulhost.com/catalog/${catalog}/${category}/${product}
to a ProductPage having the variable ${catalog}, ${category, and
${product} automatically filled in.
Or should we do it like Tapestry 4?

Next related questions is I18N or URI.
Will there be a way to have this kind of use-case:
- a ProductPage page class,
- a Product.html template (english version),
- a Product_fr.html template (french version as you guess :))
- the URL http://my.wonderfulhost.com/product.html delivering the
english version,
- the URL http://my.wonderfulhost.com/produit.html delivering the
french version.

I hope my explanation is not too much confusing :-p


Thanks,
Jérôme.

-- 
Jérôme BERNARD,
Kalixia, SARL.
http://weblog.kalixia.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tap5: Routing support?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Eventually, some where, we need to establish that "produit" implies
"product" and "fr".

Annotations are a possibliity ... but that might require pre-loading
pages at startup (or on first request) which may not scale to hundreds
or thousands of pages.

Possibly a DSL (a domain specific language) that can be hot reloaded.
Or (gasp!) an XML file.

On 2/22/07, Jérôme BERNARD <je...@gmail.com> wrote:
> On 2/22/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > I'd interpret your example as a Catalog page with an activation
> > consisting of three strings (catalog, category, product).
> >
> > So, a URL might be "/catalog/sears/games/settlers-of-catan" and the
> > Catalog page would recieve an activation event to inform it of the
> > contents of the path:  i.e.
> >
> > public class Catalog {
> >
> >   ...
> >
> >   void onActivate(String catalog, String category, String product)
> >   {
> >      ...
> >   }
> > }
>
> That would effectively be a good solution.
>
> >
> > Tapestry 5 is pretty strict on its name:  "catalog" in a URL is a
> > logical page name. This will be mapped to a particular class:
> > com.wonderfulhost.my.app.pages.Catalog perhaps.  The case of the word
> > "catalog" doesn't matter.  The Catalog page will have a template named
> > "Catalog.html" and that goes in one of only two places:  on the class
> > path with Catalog.class, or in WEB-INF  (the latter case only applies
> > to application pages, not pages from a library).
> >
> > In terms of your ease-of-use case ... that's an interesting problem.
> > It's a kind of mapping. Certainly T5 doesn't have a construct to
> > handle that right now; I'll try and keep it in mind as something not
> > to prevent. One solution may involve a server-side or client-side
> > redirect, but that's a bit ugly.
>
> In fact, my RFE is coming from the REST solutions, like what Rails is
> going to go and like Restlet too.
>
> There is even a draft RFC on this topic, as you can see on:
> http://wiki.welldesignedurls.org/URI_Templates
>
>
> Support of URI templates would be a really good way to deal with SEM.
>
>
>
> Regarding support for I18N of URI, do you have any suggestion on how
> to make this simple? I'd like to keep the same Java code, use the same
> naming for my templates (except some would be suffixed by the language
> code), BUT have "different names" for the page (meaning each language
> would have its own URI binding).
>
>
> Thanks,
> Jérôme.
>
>
> > On 2/22/07, Jérôme BERNARD <je...@gmail.com> wrote:
> > > Hi,
> > >
> > > Will Tap5 support of kind of URL routing support?
> > > What I mean is that I'd like to route/match URLs such as
> > > http://my.wonderfulhost.com/catalog/${catalog}/${category}/${product}
> > > to a ProductPage having the variable ${catalog}, ${category, and
> > > ${product} automatically filled in.
> > > Or should we do it like Tapestry 4?
> > >
> > > Next related questions is I18N or URI.
> > > Will there be a way to have this kind of use-case:
> > > - a ProductPage page class,
> > > - a Product.html template (english version),
> > > - a Product_fr.html template (french version as you guess :))
> > > - the URL http://my.wonderfulhost.com/product.html delivering the
> > > english version,
> > > - the URL http://my.wonderfulhost.com/produit.html delivering the
> > > french version.
> > >
> > > I hope my explanation is not too much confusing :-p
> > >
> > >
> > > Thanks,
> > > Jérôme.
> > >
> > > --
> > > Jérôme BERNARD,
> > > Kalixia, SARL.
> > > http://weblog.kalixia.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: dev-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
> --
> Jérôme BERNARD,
> Kalixia, SARL.
> http://weblog.kalixia.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tap5: Routing support?

Posted by Jérôme BERNARD <je...@gmail.com>.
On 2/22/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> I'd interpret your example as a Catalog page with an activation
> consisting of three strings (catalog, category, product).
>
> So, a URL might be "/catalog/sears/games/settlers-of-catan" and the
> Catalog page would recieve an activation event to inform it of the
> contents of the path:  i.e.
>
> public class Catalog {
>
>   ...
>
>   void onActivate(String catalog, String category, String product)
>   {
>      ...
>   }
> }

That would effectively be a good solution.

>
> Tapestry 5 is pretty strict on its name:  "catalog" in a URL is a
> logical page name. This will be mapped to a particular class:
> com.wonderfulhost.my.app.pages.Catalog perhaps.  The case of the word
> "catalog" doesn't matter.  The Catalog page will have a template named
> "Catalog.html" and that goes in one of only two places:  on the class
> path with Catalog.class, or in WEB-INF  (the latter case only applies
> to application pages, not pages from a library).
>
> In terms of your ease-of-use case ... that's an interesting problem.
> It's a kind of mapping. Certainly T5 doesn't have a construct to
> handle that right now; I'll try and keep it in mind as something not
> to prevent. One solution may involve a server-side or client-side
> redirect, but that's a bit ugly.

In fact, my RFE is coming from the REST solutions, like what Rails is
going to go and like Restlet too.

There is even a draft RFC on this topic, as you can see on:
http://wiki.welldesignedurls.org/URI_Templates


Support of URI templates would be a really good way to deal with SEM.



Regarding support for I18N of URI, do you have any suggestion on how
to make this simple? I'd like to keep the same Java code, use the same
naming for my templates (except some would be suffixed by the language
code), BUT have "different names" for the page (meaning each language
would have its own URI binding).


Thanks,
Jérôme.


> On 2/22/07, Jérôme BERNARD <je...@gmail.com> wrote:
> > Hi,
> >
> > Will Tap5 support of kind of URL routing support?
> > What I mean is that I'd like to route/match URLs such as
> > http://my.wonderfulhost.com/catalog/${catalog}/${category}/${product}
> > to a ProductPage having the variable ${catalog}, ${category, and
> > ${product} automatically filled in.
> > Or should we do it like Tapestry 4?
> >
> > Next related questions is I18N or URI.
> > Will there be a way to have this kind of use-case:
> > - a ProductPage page class,
> > - a Product.html template (english version),
> > - a Product_fr.html template (french version as you guess :))
> > - the URL http://my.wonderfulhost.com/product.html delivering the
> > english version,
> > - the URL http://my.wonderfulhost.com/produit.html delivering the
> > french version.
> >
> > I hope my explanation is not too much confusing :-p
> >
> >
> > Thanks,
> > Jérôme.
> >
> > --
> > Jérôme BERNARD,
> > Kalixia, SARL.
> > http://weblog.kalixia.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Jérôme BERNARD,
Kalixia, SARL.
http://weblog.kalixia.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tap5: Routing support?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Well, if you page name is, say, "admin/Menu" then you put your
template in WEB-INF/admin/Menu.  You class name will be
...pages.admin.Menu.

Allowing templates in WEB-INF adds a touch of ambiguity (the template
can go in two places) but its a big convienience, especially for
non-Java coders who don't want to have to mess around too deep in the
source hierarchy.

On 2/22/07, Robert Zeigler <ro...@scazdl.org> wrote:
> <snip>
> On Feb 22, 2007, at 2/2210:57 AM , Howard Lewis Ship wrote:
> > Tapestry 5 is pretty strict on its name:  "catalog" in a URL is a
> > logical page name. This will be mapped to a particular class:
> > com.wonderfulhost.my.app.pages.Catalog perhaps.  The case of the word
> > "catalog" doesn't matter.  The Catalog page will have a template named
> > "Catalog.html" and that goes in one of only two places:  on the class
> > path with Catalog.class, or in WEB-INF  (the latter case only applies
> > to application pages, not pages from a library).
> </snip>
>
> So, for templates in WEB-INF, the templates have to reside in WEB-INF
> proper, or can they reside in some subdirectory of WEB-INF (from your
> description above, I'm assuming the former, but I wanted to double
> check my assumption).
>
> Thanks,
>
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tap5: Routing support?

Posted by Robert Zeigler <ro...@scazdl.org>.
<snip>
On Feb 22, 2007, at 2/2210:57 AM , Howard Lewis Ship wrote:
> Tapestry 5 is pretty strict on its name:  "catalog" in a URL is a
> logical page name. This will be mapped to a particular class:
> com.wonderfulhost.my.app.pages.Catalog perhaps.  The case of the word
> "catalog" doesn't matter.  The Catalog page will have a template named
> "Catalog.html" and that goes in one of only two places:  on the class
> path with Catalog.class, or in WEB-INF  (the latter case only applies
> to application pages, not pages from a library).
</snip>

So, for templates in WEB-INF, the templates have to reside in WEB-INF  
proper, or can they reside in some subdirectory of WEB-INF (from your  
description above, I'm assuming the former, but I wanted to double  
check my assumption).

Thanks,

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tap5: Routing support?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'd interpret your example as a Catalog page with an activation
consisting of three strings (catalog, category, product).

So, a URL might be "/catalog/sears/games/settlers-of-catan" and the
Catalog page would recieve an activation event to inform it of the
contents of the path:  i.e.

public class Catalog {

  ...

  void onActivate(String catalog, String category, String product)
  {
     ...
  }
}

Tapestry 5 is pretty strict on its name:  "catalog" in a URL is a
logical page name. This will be mapped to a particular class:
com.wonderfulhost.my.app.pages.Catalog perhaps.  The case of the word
"catalog" doesn't matter.  The Catalog page will have a template named
"Catalog.html" and that goes in one of only two places:  on the class
path with Catalog.class, or in WEB-INF  (the latter case only applies
to application pages, not pages from a library).

In terms of your ease-of-use case ... that's an interesting problem.
It's a kind of mapping. Certainly T5 doesn't have a construct to
handle that right now; I'll try and keep it in mind as something not
to prevent. One solution may involve a server-side or client-side
redirect, but that's a bit ugly.

On 2/22/07, Jérôme BERNARD <je...@gmail.com> wrote:
> Hi,
>
> Will Tap5 support of kind of URL routing support?
> What I mean is that I'd like to route/match URLs such as
> http://my.wonderfulhost.com/catalog/${catalog}/${category}/${product}
> to a ProductPage having the variable ${catalog}, ${category, and
> ${product} automatically filled in.
> Or should we do it like Tapestry 4?
>
> Next related questions is I18N or URI.
> Will there be a way to have this kind of use-case:
> - a ProductPage page class,
> - a Product.html template (english version),
> - a Product_fr.html template (french version as you guess :))
> - the URL http://my.wonderfulhost.com/product.html delivering the
> english version,
> - the URL http://my.wonderfulhost.com/produit.html delivering the
> french version.
>
> I hope my explanation is not too much confusing :-p
>
>
> Thanks,
> Jérôme.
>
> --
> Jérôme BERNARD,
> Kalixia, SARL.
> http://weblog.kalixia.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org