You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Peterson <da...@crowdsoft.com> on 2007/06/12 12:51:23 UTC

T5: Direct URL to Class Mappings are Inconvenient

I'm finding that I often want my pages to have the same names as classes in
my model.

For example, I have an Article class in my model and I want the article
viewer URL to be "/article" (with a context specifying the article
reference). Although this is possible by using fully-qualified class names
everywhere, it's messy and error prone.

Ideally, I'd like to have the URL "/article" mapped to
com.mydomain.pages.ArticleViewer. Is that easy to do? (If it's possible
could you post some code?)

If not, how about a "Page" suffix for page classes, e.g. ArticlePage? I
think that would be a useful convention and might avoid having to compromise
the URLs, model class names or code readability.

David

Re: T5: Direct URL to Class Mappings are Inconvenient

Posted by Howard Lewis Ship <hl...@gmail.com>.
The current rules allow for this:

pages.view.ViewArticle is mapped to "view/article" (not "view/viewarticle").

This is very useful, since you'll likely add other options: "add/" or
"edit/" or "search/".

On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
> I'm finding that I often want my pages to have the same names as classes in
> my model.
>
> For example, I have an Article class in my model and I want the article
> viewer URL to be "/article" (with a context specifying the article
> reference). Although this is possible by using fully-qualified class names
> everywhere, it's messy and error prone.
>
> Ideally, I'd like to have the URL "/article" mapped to
> com.mydomain.pages.ArticleViewer. Is that easy to do? (If it's possible
> could you post some code?)
>
> If not, how about a "Page" suffix for page classes, e.g. ArticlePage? I
> think that would be a useful convention and might avoid having to compromise
> the URLs, model class names or code readability.
>
> David
>


-- 
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Direct URL to Class Mappings are Inconvenient

Posted by Yann Ramin <at...@stackworks.net>.
As long as we can fix the
package foo.pages.bar;

class Bar {
}

turning into /bar/ and not finding the html page bug ;)

Howard Lewis Ship wrote:
> That may not make it into the initial release of Tapestry; there are
> so many other concerns that are more critical!
> 
> On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
>> It's the word "view" that I'd like to get rid of because the more 
>> slashes in
>> your URL, the lower the page is ranked in certain search engines.
>>
>> /article -> ArticleViewer
>> /admin/article/edit -> ArticleEditor
>>
>> It would be nice to have the mapping strategy from URI to classname (and
>> back) be made pluggable or more configurable.
>>
>> David
>>
>>
>>
>> > The current rules allow for this:
>> >
>> > pages.view.ViewArticle is mapped to "view/article" (not
>> "view/viewarticle").
>> >
>> > This is very useful, since you'll likely add other options: "add/" or
>> > "edit/" or "search/".
>> >
>> > On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
>> > > I'm finding that I often want my pages to have the same names as 
>> classes
>> in
>> > > my model.
>> > >
>> > > For example, I have an Article class in my model and I want the 
>> article
>> > > viewer URL to be "/article" (with a context specifying the article
>> > > reference). Although this is possible by using fully-qualified class
>> names
>> > > everywhere, it's messy and error prone.
>> > >
>> > > Ideally, I'd like to have the URL "/article" mapped to
>> > > com.mydomain.pages.ArticleViewer. Is that easy to do? (If it's 
>> possible
>> > > could you post some code?)
>> > >
>> > > If not, how about a "Page" suffix for page classes, e.g. 
>> ArticlePage? I
>> > > think that would be a useful convention and might avoid having to
>> compromise
>> > > the URLs, model class names or code readability.
>> > >
>> > > David
>> > >
>> >
>> >
>> > --
>> > 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Direct URL to Class Mappings are Inconvenient

Posted by Howard Lewis Ship <hl...@gmail.com>.
That may not make it into the initial release of Tapestry; there are
so many other concerns that are more critical!

On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
> It's the word "view" that I'd like to get rid of because the more slashes in
> your URL, the lower the page is ranked in certain search engines.
>
> /article -> ArticleViewer
> /admin/article/edit -> ArticleEditor
>
> It would be nice to have the mapping strategy from URI to classname (and
> back) be made pluggable or more configurable.
>
> David
>
>
>
> > The current rules allow for this:
> >
> > pages.view.ViewArticle is mapped to "view/article" (not
> "view/viewarticle").
> >
> > This is very useful, since you'll likely add other options: "add/" or
> > "edit/" or "search/".
> >
> > On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
> > > I'm finding that I often want my pages to have the same names as classes
> in
> > > my model.
> > >
> > > For example, I have an Article class in my model and I want the article
> > > viewer URL to be "/article" (with a context specifying the article
> > > reference). Although this is possible by using fully-qualified class
> names
> > > everywhere, it's messy and error prone.
> > >
> > > Ideally, I'd like to have the URL "/article" mapped to
> > > com.mydomain.pages.ArticleViewer. Is that easy to do? (If it's possible
> > > could you post some code?)
> > >
> > > If not, how about a "Page" suffix for page classes, e.g. ArticlePage? I
> > > think that would be a useful convention and might avoid having to
> compromise
> > > the URLs, model class names or code readability.
> > >
> > > David
> > >
> >
> >
> > --
> > 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
> >
> > ---------------------------------------------------------------------
>


-- 
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Direct URL to Class Mappings are Inconvenient

Posted by David Peterson <da...@crowdsoft.com>.
It's the word "view" that I'd like to get rid of because the more slashes in
your URL, the lower the page is ranked in certain search engines.

/article -> ArticleViewer
/admin/article/edit -> ArticleEditor

It would be nice to have the mapping strategy from URI to classname (and
back) be made pluggable or more configurable.

David



> The current rules allow for this:
>
> pages.view.ViewArticle is mapped to "view/article" (not
"view/viewarticle").
>
> This is very useful, since you'll likely add other options: "add/" or
> "edit/" or "search/".
>
> On 6/12/07, David Peterson <da...@crowdsoft.com> wrote:
> > I'm finding that I often want my pages to have the same names as classes
in
> > my model.
> >
> > For example, I have an Article class in my model and I want the article
> > viewer URL to be "/article" (with a context specifying the article
> > reference). Although this is possible by using fully-qualified class
names
> > everywhere, it's messy and error prone.
> >
> > Ideally, I'd like to have the URL "/article" mapped to
> > com.mydomain.pages.ArticleViewer. Is that easy to do? (If it's possible
> > could you post some code?)
> >
> > If not, how about a "Page" suffix for page classes, e.g. ArticlePage? I
> > think that would be a useful convention and might avoid having to
compromise
> > the URLs, model class names or code readability.
> >
> > David
> >
>
>
> --
> 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
>
> ---------------------------------------------------------------------