This is a tricky error to fix.  At issue is the fact that the page
activation context can, theoretically, look like anything: strings,
numbers, path-like-stuff, whatever.  The layers of conversion from the
path in the URL to, ultimately, numbers or entity objects happens
very, very late. In theory, the number of values, and their type, may
vary from request to request (in practice, this is highly doubtful!).

By the time Tapestry gets to the point where it can figure out if the
page activation context is valid, it's actually past the point where
it has committed to handling the request.

I can imagine fixing this by adding a new event to the page lifecycle
that allows the page to look at the event context and decide whether
to continue.  However, this would either have to be kludged into some
existing place it doesn't belong, or will require some changes to
public APIs.

I think the best approach is to leverage the ignored paths mechanism.
That is early in the response processing pipeline, and will have a
good chance to ignore what should be ignored.

On Fri, Oct 15, 2010 at 1:27 AM, Moritz Gmelin <moritz.gme...@gmx.de> wrote:
> Hi,
>
> we've been running into this also.
>
> Fixed this by creating a custom 404 page and setting this as the default 
> start page.
>
> FourOhFour.tml
>
> <html   xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>  <head>
>  <meta http-equiv="Refresh" content="0; url=${starturl}" />
>  </head>
>  <body>
>  Page not found
>  </body>
> </html>
>
>
> And FourOhFour.java
>
> import org.apache.tapestry5.Link;
> import org.apache.tapestry5.annotations.AfterRender;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.apache.tapestry5.services.PageRenderLinkSource;
> import org.apache.tapestry5.services.Response;
>
> public class FourOhFour
> {
>
>       �...@inject
>        private Response response;
>
>       �...@inject
>        private PageRenderLinkSource resources;
>
>
>       �...@afterrender
>        public void afterRender()
>        {
>                response.setStatus(404);
>        }
>
>
>        public Link getStartURL()
>        {
>                return 
> resources.createPageRenderLink(SomeOtherStartPage.class);
>        }
>
> }
>
> And in AppModule we set the default start page to our FourOhFour page
>
>        public static void contributeApplicationDefaults(
>                                        MappedConfiguration<String, String> 
> configuration)
>        {
>                configuration.add(SymbolConstants.START_PAGE_NAME, 
> "FourOhFour");
>
>        }
>
>
> Hope this helps.
>
> M.
>
>
> Am 15.10.2010 um 10:09 schrieb stephanos:
>
>>
>>> As the JIRA ticket says, this is expected behavior. In your case, /blabla
>>> is considered a request to / (Index) with one activation context parameter
>>> 'blabla' as there's no page named 'blabla'.
>>
>> I was just wondering why the ticket is still 'Open' and has a patch that
>> apparently was never actually used...
>>
>>> Hmm... that's true, the Start page is "broken" as well in 5.2 - you
>>> can't get it to return 404s anymore using Start page the same way as
>>> in 5.1.
>>
>> So the solution should be renaming it 'Start.tml' (could be documented
>> somewhere *g*)? I used 5.2 straight away without 5.1 because I needed the
>> Spring 3 support. Could you open a JIRA issue then? - it might be better if
>> an experienced tapestry user opens it :)
>>
>> Cheers!
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/No-404-error-is-raised-tp3212773p3213305.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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to