You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Arming, Sebastian" <Se...@oeaw.ac.at> on 2010/06/14 14:15:31 UTC

Absolute links on 404 error page

Hey,

I've setup a custom 404 error page in my web.xml which is generated by Tapestry.

As links generated by tapestry are (normally) relative, they don't work on a 404 page for a path with several slashes.
That is if I navigate to (non existing) "/a/b", the browser interprets the link "contact" as pointing to "/a/contact/" instead of "/contact".

As a workaround I've put

void setupRender(){
      request.setAttribute(InternalConstants.GENERATING_RENDERED_PAGE, true);
}

into the error page.

Is there a way to achieve a similar outcome without using the internal api?

I don't want to redirect to the error page for usability (and probably HTTP standard) reasons.

Thanks,
Sebastian

Re: Absolute links on 404 error page

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Hi Sebastian,

I had the same problem and created a page annotation to add to my
error / 404 pages so *only* the error pages created absolute URIs and
the rest of the app worked as is (and with relative URIs).

See here:

http://old.nabble.com/-T5.1--Page-Annotation-to-Render-Absolute-URIs-to28539375.html

Steve.
--
Steve Eynon


On 14 June 2010 15:57, Arming, Sebastian <Se...@oeaw.ac.at> wrote:
> -----Original Message-----
> From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com]
> Sent: Monday, June 14, 2010 4:49 PM
> Subject: Re: Absolute links on 404 error page
>
>> This is also a Tapestry configuration symbol, so it can be set from your
>> AppModule class. ;)
>
> Just did that.
> Loosing relative URIs seems to be the smallest evil - by far.
>
> Thanks to both of you!
> Sebastian
>

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


RE: Absolute links on 404 error page

Posted by "Arming, Sebastian" <Se...@oeaw.ac.at>.
-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com] 
Sent: Monday, June 14, 2010 4:49 PM
Subject: Re: Absolute links on 404 error page

> This is also a Tapestry configuration symbol, so it can be set from your  
> AppModule class. ;)

Just did that.
Loosing relative URIs seems to be the smallest evil - by far.

Thanks to both of you!
Sebastian

Re: Absolute links on 404 error page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 14 Jun 2010 09:44:03 -0300, Christian Riedel  
<cr...@googlemail.com> wrote:

> sounds like this could be solved when you redirect to your 404 page  
> properly ( to /error for example). then all links should be ok.
>
> another way to force tapestry to generate absolute links is adding this  
> to the jre-args:
>
> -Dtapestry.force-absolute-uris=true

This is also a Tapestry configuration symbol, so it can be set from your  
AppModule class. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Absolute links on 404 error page

Posted by Christian Riedel <cr...@googlemail.com>.
hi,

sounds like this could be solved when you redirect to your 404 page properly ( to /error for example). then all links should be ok. 

another way to force tapestry to generate absolute links is adding this to the jre-args: 

-Dtapestry.force-absolute-uris=true

hope that helps :)

christian



Am 14.06.2010 um 14:15 schrieb Arming, Sebastian:

> Hey,
> 
> I've setup a custom 404 error page in my web.xml which is generated by Tapestry.
> 
> As links generated by tapestry are (normally) relative, they don't work on a 404 page for a path with several slashes.
> That is if I navigate to (non existing) "/a/b", the browser interprets the link "contact" as pointing to "/a/contact/" instead of "/contact".
> 
> As a workaround I've put
> 
> void setupRender(){
>      request.setAttribute(InternalConstants.GENERATING_RENDERED_PAGE, true);
> }
> 
> into the error page.
> 
> Is there a way to achieve a similar outcome without using the internal api?
> 
> I don't want to redirect to the error page for usability (and probably HTTP standard) reasons.
> 
> Thanks,
> Sebastian


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