[Hippo-cms7-user] 404 page for sub levels

William Borg Barthet w.borgbarthet at onehippo.com
Thu Sep 27 15:49:07 CEST 2012


Hi Dennis,

I assume you have some wildcard matcher under your /nieuws sitemap to
render news articles. What you can do is redirect to the 404 page in the
component that renders the news (or in the base component) when the content
bean is null. This is how it is done in the GOGREEN demo:


public class Detail extends BaseComponent {

    public static final Logger log = LoggerFactory.getLogger(Detail.class);
    private static final int PATH_DEPTH = 4;

    @Override
    public void doBeforeRender(HstRequest request, HstResponse response) {

        super.doBeforeRender(request, response);
        HippoBean document = getContentBean(request);

        if (document == null) {
            redirectToNotFoundPage(response);
            return;
        }
        request.setAttribute("document", document);


kind regards,

William Borg Barthet






On 27 September 2012 15:43, Dennis Vis <dennis.vis at incentro.com> wrote:

> Good day all,
>
> I'm trying to implement a 404 page. The documentation on onehippo.orgdescribes placing an _any_ node at the root of my sitemap. This should
> catch all uri's that cannot be mapped to a valid page. This does work, but
> only for top level uri's. On my local environment
> http://localhost:8080/site/afy4bdsv results in a nice 'not found' page.
> But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where
> the 'not found' message should be, as well as an error on the command line
> about not being able to resolve the address.
> How should I go about creating a 404 page for all uri's that cannot be
> matched?
>
>
> *Dennis Vis*
> Consultant *|* Incentro Rotterdam
>
> Fascinatio Boulevard 562-4
> Capelle aan den IJssel, The Netherlands, 2909 VA
>
> *E:* dennis.vis at incentro.com
> *T:* +31102020544
> *M: *+31640801868
> *W:* www.incentro.com
> [image: Logo Incentro]<http://www.incentro.com/nl/article/incentro-de-beste-werkgever-van-nederland>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>



-- 
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20120927/fe464937/attachment.htm>


More information about the Hippo-cms7-user mailing list