Custom Error Pages

Version 1

    Creating custom error pages in GateIn requires an extra step than what would normally be encountered with a java based web application. If the following steps are not followed, then GateIn will use the default error pages for the server.

     

    Modify the portal web.xml to add the custom error pages

    You will need to configure the web.xml of the gatein.ear/02Portal.war just like any other normal web application which has custom error pages.

     

    For example, to add a custom 404 page, you would need to add the following to the gatein.ear/02portal.war/WEB-INF/web.xml

     

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

     

    You would then add your error.html page to the gatein.ear/02portal.war directory

     

    Extra Step Needed In GateIn

     

    From the first step, the error page to get redirected to is going to end up being /portal/error.html. By default the portal will try and resolve the error.html as being the name of a portal or some other resource. We need to inform the portal on how to handle this type of url. This will require modifying the controller.xml file (located at server/default/conf/gatein/controller.xml). Add the following to the controller.xml file to have the server treat the url as a static resource instead of trying to resolve it as a portal or resource:


      <route path="/error.html">
        <route-param qname="gtn:handler">
          <value>staticResource</value>
        </route-param>
      </route>
    

     

     

    Test the custom 404 page by typing in a portal url which doesn't correspond to a portal: http://localhost:8080/portal/none