If you're index page is supposed to render something and the
parameters are all wrong then you can return a 404 from there. The
strategy that I'm using is to gather up all my parameters in specific
onActivate methods and then the empty param onActivate checks the
context and returns 404 if it's not valid.

Object onActivate() {
        if ( !isValidContext() ) {
            return new ErrorCode(404, "The requested page was not found");
        }
        return null;
}

The code for implementing ErrorCode can be found in the archives of this list.

Josh

On Mon, Jun 7, 2010 at 10:52 AM, Kalle Korhonen
<kalle.o.korho...@gmail.com> wrote:
> On Mon, Jun 7, 2010 at 10:31 AM, Todd Orr <torr0...@gmail.com> wrote:
>> This works. However, it is awkward as now I need to specifically refer to my
>> start page rather than the directory, somedir/start vs somedir/. I hope this
>> is resolved in future releases.
>
> What I do is that I use a Start page at the root level (which is
> rendered if user requests just the root context) and Index pages in
> sub-directories - if users get at least the directory right in the
> latter case I can then handle showing 404s manually in onActivate() if
> I need to). But yes, the built-in logic is perhaps a bit immature but
> I'm not sure what would be the ideal approach. On one hand, you want
> to handle custom context and not show unnecessary errors, but on the
> other hand you do want 404 on urls that really don't exist in your
> application.
>
> Kalle
>
>
>> On Mon, Jun 7, 2010 at 12:50 PM, Kalle Korhonen
>> <kalle.o.korho...@gmail.com>wrote:
>>
>>> Use a Start page instead of an Index page - the index page treats
>>> everything as the context for the Index page if the string doesn't map
>>> to any other page.
>>>
>>> Kalle
>>>
>>>
>>> On Mon, Jun 7, 2010 at 9:43 AM, Todd Orr <torr0...@gmail.com> wrote:
>>> > I've setup a custom 404 page according to
>>> >
>>> http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages
>>> .
>>> > However, whenever I navigate to a URL that does not exist Tapestry simply
>>> > renders the index page for that directory or a directory above if none
>>> > exists in that directory. How do you force Tapestry to use a custom 404?
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to