Tapestry
  1. Tapestry
  2. TAPESTRY-1823

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

    Details

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

      Description

      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).

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569305 ] jira [ 12590558 ]
        Mark Thomas made changes -
        Workflow jira [ 12414914 ] Default workflow, editable Closed status [ 12569305 ]
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.0.8 [ 12312898 ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development