Thiago, >> I prefer another approach: according to my experience, it's rare to have an >> Index page with activation context parameters.
This is a little presumptuous. I have built a couple apps where I use the index page activation parameters to pull html content from a database. > The typical URL will be > "/user/12345" but an errant CSS rule or relative URL to an image can > result in "/user/images/icon.png" and a NumericFormatException trying > to convert "images" to a Long (before accessing the User). I haven't done the due diligence to know if it would be an easy matter to simply return a 404 at the point we realize the types don't match, but doesn't that seem like reasonable default behavior? In non-production mode we can still return a useful body explaining what happened. In production mode we give a standard "not found" body. Josh On Mon, Apr 4, 2011 at 1:04 PM, Howard Lewis Ship <[email protected]> wrote: > On Mon, Apr 4, 2011 at 12:08 PM, Thiago H. de Paula Figueiredo > <[email protected]> wrote: >> On Mon, 04 Apr 2011 14:29:26 -0300, Howard Lewis Ship <[email protected]> >> wrote: >> >>> @MatchExtraPath("\\d+") >>> public class Index >>> { >>> } >> >> I prefer another approach: according to my experience, it's rare to have an >> Index page with activation context parameters. Thus, I think we can create a >> mixin that raises a 404 when page activation context is not empty, >> automatically apply it to all Index pages and have a configuration symbol to >> configure this, most probably with a false default value to provide >> backwards compatibility. > > This may be true at the root level, but I often create index pages in > subpackages for this purpose, i.e. root.pages.user.UserIndex that has > a page activation context that's a user id. The typical URL will be > "/user/12345" but an errant CSS rule or relative URL to an image can > result in "/user/images/icon.png" and a NumericFormatException trying > to convert "images" to a Long (before accessing the User). > >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and >> instructor >> Owner, Ars Machina Tecnologia da Informação Ltda. >> http://www.arsmachina.com.br >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > 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]
