Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

Re: 404 from onActivate

Igor Drobiazko

2010-03-19

Replies: Find Java Web Hosting

Author LoginPost Reply
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.oestereter@(protected):

> 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.mlist@(protected):
> > 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-unsubscribe@(protected)
> >> For additional commands, e-mail: users-help@(protected)
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@(protected)
> > For additional commands, e-mail: users-help@(protected)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>


--
Best regards,

Igor Drobiazko
http://tapestry5.de/blog
©2008 gg3721.com - Jax Systems, LLC, U.S.A.