Fork me on GitHub

HST-2 Page Not Found Exception Handler Integration


If you want to forward the request to the 'page-not-found' sitemap item path in your controller, then you may configure HstBridgeHandlerExceptionsResolver bean with setting the 'page-not-found' sitemap item reference ID and you can make your controller throw HstPageNotFoundException in a method (which is invoked in doBeforeRender phase).

Then the HstBridgeHandlerExceptionsResolver finds the path info of the 'page-not-found' sitemap item configured in HST Site configuration in the repository and forward the request to the path info.

For example, you may configure the global HandlerExceptionResolver bean like the following example:


  <!-- SNIP -->

  <!-- handlerExceptionResolver setting to forward to 'notFound' sitemap item when HstPageNotFoundException occurs. -->
  <bean id="handlerExceptionResolver" class="">
    <property name="pageNotFoundRefId" value="notFound" />

  <!-- SNIP -->


See the Javadoc of HstBridgeHandlerExceptionsResolver for more detail.