How to display a custom error page when browsing non-existing page in JBoss Portal

Solution Unverified - Updated -

Environment

  • JBoss Enterprise Portal Platform (EPP)
    • 5.x
  • JBoss Portal Platform (JPP)
    • 6.x

Issue

  • I would like to display a custom "NotFoundError" error page when user browses a non-existing portal page. How can I configure the custom 404 page for EPP?

Resolution

1. for the non-existing context http://localhost:8080/foobar, please refer to the kcs article: How do I configure a custom error page in JBoss ?

2. for the non-existing page just below the /portal http://localhost:8080/portal/foobar, configure the error-page in $JBOSS_HOME/server/$PROFILE/deploy/gatein.ear/02portal.war/WEB-INF/web.xml:

       <error-page>
          <error-code>404</error-code>
          <location>/error.jsp</location>
       </error-page>

and place your custom error page error.jsp under $JBOSS_HOME/server/$PROFILE/deploy/gatein.ear/02portal.war.

3. for the non-existing http://localhost:8080/portal/private/foobar or http://localhost:8080/portal/public/foobar, customize the page gatein.ear/02portal.war/portal-unavailable.jsp. Please note that, there's no way to configure a different error page name because this is hard coded in the java source code.

4. for the non-existing http://localhost:8080/portal/private/available-portal/not-available-page or http://localhost:8080/portal/public/available-portal/not-available-page, it will go to the default page of the portal. This is handled by EPP 5. There's no way can change it.

Note that a feature request has been raised to get this functionality changed in an upcoming release:
https://bugzilla.redhat.com/show_bug.cgi?id=807961

Until this feature has been implemented, users of JPP 6 could extend the default PortalRequestHandler as shown in this project:
https://github.com/martinweiler/CustomPortalRequestHandler

5. for the non-existing page in the portlet application, use the error-page tag in the corresponding portlet application's web.xml or the mechanisms mentioned in the Portlet Bridge guide: http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.1/html/Reference_Guide/sect-Reference_Guide-Developing_Portlets_with_the_Bridge-General_Error_Handling.html

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments