+1 for HTTP 404.

But you don't have to use StreamResponse for that, just return new
org.apache.tapestry5.services.HttpError(404, "Page Not Found"); from
onActivate.

Note: If you deploy your app on tomcat, you should also add ERROR
dispatcher to the tapestry filter mapping in web.xml (if you don't do this
you may get strange NPEs instead of HTTP 404):

    <filter-mapping>

        <filter-name>app</filter-name>

        <url-pattern>/*</url-pattern>

        <dispatcher>REQUEST</dispatcher>

        <dispatcher>ERROR</dispatcher>

    </filter-mapping>


On Sun, Dec 16, 2012 at 9:05 PM, trsvax <trs...@gmail.com> wrote:

> Maybe, but they could come from anywhere including just typing in the URL
> (ie
> no where). The only way that might work sometimes is get the referring URL
> from the request and send them back there.
>
> You could also return a 404 "Page not found" with a StreamResponse and that
> might make the most sense.
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Best-way-to-prevent-page-to-be-accessed-without-context-tp5718737p5718763.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to