[ 
https://issues.apache.org/jira/browse/TAPESTRY-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship reassigned TAPESTRY-1823:
----------------------------------------------

    Assignee: Howard M. Lewis Ship

> It is not possible to create a reasonable implementation of 
> RequestExceptionHandler without importing internal interfaces and services
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1823
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1823
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>
> 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).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to