Just inject service RequestGlobals [1] into your page, retrieve the Response
from it and send the 404 error to the client.

[1]
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/RequestGlobals.html

On Fri, Mar 19, 2010 at 6:39 PM, Mike Oestereter
<mike.oestere...@gmail.com>wrote:

> That's what I'm doing at the moment, but is not what I want.
> The result from the user's perspective is is a redirect 302 (or
> something) to a 404, which I don't think makes sense?
>
> On Fri, Mar 19, 2010 at 4:51 PM, Christian Riedel
> <cr.ml...@googlemail.com> wrote:
> > I would create an Error404.java page and redirect to it in case your
> onActivate doesn't find a corresponding entity.
> >
> > Am 19.03.2010 um 15:04 schrieb Mike Oestereter:
> >
> >> Hello
> >>
> >> I've got a page that takes the context as parameter to produce a
> >> result from db, e.g.:  http:/hostname/app/page/123
> >>
> >> If the db result for 123 does not exist I would like to throw a 404.
> >>
> >> Currently I'm using...
> >>
> >> Object onActivate(EventContext context) {
> >>  //db lookup code to prepare page
> >> }
> >>
> >> Is the best way to throw a custom error that gets picked up by the
> >> ExceptionReport page and "rendered" with a status code of 404?
> >>
> >> Or is there a way to initialize/prepare the page earlier in the cycle
> >> and detect the non existence of resource 123?
> >>
> >> Thanks
> >> Theo
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de/blog

Reply via email to