Hi,

thanks for replay. My situation is exactly as you wrote. After all this approach works just in case of Jetty. It doesn't work with Tomcat 6.0.20 and 6.0.24. I have tested it. Only difference between processing page that should lead to error404 is that at tomcat page processing continue after error 404 in send, so there appears some NullPointerExceptions. I don't see this exception at Jetty.

Jan


Kalle Korhonen wrote:
If you want Tapestry to render your error page, you need to configure
the filter to handle error dispatches:
        <filter-mapping>
                <filter-name>app</filter-name>
                <url-pattern>/*</url-pattern>
                <dispatcher>REQUEST</dispatcher>
                <dispatcher>ERROR</dispatcher>
        </filter-mapping>

Entirely possible that Jetty would route this to the app by default
but I think it's off-spec.

Kalle


On Fri, Mar 19, 2010 at 2:50 PM, Jan Jirout <jir...@coroptis.com> wrote:
Hi,

I have same problem. I don't like solution with HTTP redirect to page that
return 404 also. This solution is not fully logic from user perspective. I
would like to by able to show error404 without any redirect.

I have tried in onActivation method code:

response.sendError(404, null);

where:

  @Inject
  private org.apache.tapestry5.services.Response response;

It works in jetty, but didn't work in Tomcat ;-). I hope, that somebody will
help.

Regards

Jan

Igor Drobiazko wrote:
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




---------------------------------------------------------------------
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

Reply via email to