Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1823

It is not possible to create a reasonable implementation of RequestExceptionHandler without importing internal interfaces and services


    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.8
    • Component/s: tapestry-core
    • Labels:


      It's not just a case of making the necessary interfaces public, but of providing public wrappers that ... for instance ... reference a page by name rather than as a Page instance (an internal type that should stay that way).

      here's an example:

      import java.io.IOException;

      import org.apache.commons.logging.Log;
      import org.apache.tapestry.Link;
      import org.apache.tapestry.internal.services.LinkFactory;
      import org.apache.tapestry.services.RequestExceptionHandler;
      import org.apache.tapestry.services.Response;

      public class ProductionRequestExceptionHandler implements RequestExceptionHandler {

      private final Log _log;

      private final LinkFactory _linkFactory;

      private final Response _response;

      public ProductionRequestExceptionHandler(Log log, LinkFactory linkFactory, Response response)

      { _log = log; _linkFactory = linkFactory; _response = response; }

      public void handleRequestException(Throwable exception) throws IOException

      { _log.error("An exception has occurred: " + exception.getMessage(), exception); Link link = _linkFactory.createPageLink("AppError", false); _response.sendRedirect(link.toRedirectURI()); }


      LinkFactory is internal. Even if it was promoted up, it includes Page which is internal.

      Suggestion: create a public service, PageLinkFactory with method:

      Link createPageLink(String pageName, boolean override, Object... activationContext)

      that's a tiny, thin wrapper around the internal LinkFactory.

      Something similar, for using a page to generate a direct response (rather than a redirect) might be nice, but is less urgent (exception generally occur during action requests, for which we should send a redirect).




            • Assignee:
              hlship Howard M. Lewis Ship
              hlship Howard M. Lewis Ship
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: