Projects‎ > ‎

Page Flow Controller Improvements

Better handling of "not found" page and other status codes

Status

This is implemented as of 2012-06-22. See this closed issue.

Currently

  • PFC only calls "not found" page if an incoming path is not found
  • however, code called down the line cannot cause the PFC to run the "not found" page

Requirement

  • PFC must run the "not found" page upon catching certain exceptions, e.g. HttpStatusCodeException and ResourceNotFoundException
  • PFC could run a new "unauthorized" page upon catching HttpStatusCodeException with the appropriate code
  • PFC could run a new "internal error" page upon catching other exceptions
  • This must work for nested PFCs as well: i.e. if a nested PFC
    • declares a not found handler, this must run
    • doesn't declare one, the outer PFC's must run

Relation to sendError()

Related: as of 2011-08, InitUtils supports a sendError() function. Its purpose is to allow code down the line to interrupt processing and to set an error code. However, this does not provide the ability to run a custom page.

If the PFC improvement is implemented, this functionality can still be kept, in case the page flow doesn't declare handlers. If it does, the only difference is that custom content can be output for a given error handler. However, the proper status code will be set.

Relation to the servlet error pipeline

This remains. The error pipeline is called if no handler has taken care of an exception, or if the PFC itself crashes.

Implementation

PFC architecture might need to change so that the "not found" page is really run as a separate pipeline. Then the current "not found" path could simply run code that throws a HttpStatusCodeException(404).

Comments