A runtime patch for the root path empty response bug

TAPESTRY-1627 A Start page redirect request will produce an empty response if the request URL was root, e.g: http://localhost:8080/myapp/

This is not fixed as of T5.0.6, so if QA is on your back you can patch Tapestry at runtime by adding the code below to your AppModule.

In your AppModule.java file, add the following method

    // TODO: fix for TAPESTRY-1627 - last checked 2007/11/4
    public void contributeMasterDispatcher(
        OrderedConfiguration<Dispatcher> configuration,
        PageRenderRequestHandler pageRenderRequestHandler,
        ComponentClassResolver componentClassResolver,
        String startPageName,
        PageResponseRenderer pageResponseRenderer)
        class RootPathDispatcherFix implements Dispatcher
            private final ComponentClassResolver _componentClassResolver;

            private final PageRenderRequestHandler _handler;

            private final PageResponseRenderer _renderer;

            private final String _startPageName;

            private final String[] _emptyContext = new String[0];

            public RootPathDispatcherFix(
                final ComponentClassResolver componentClassResolver,
                final PageRenderRequestHandler handler,
                final PageResponseRenderer renderer,
                final String startPageName)
                _componentClassResolver = componentClassResolver;
                _handler = handler;
                _renderer = renderer;
                _startPageName = startPageName;

            public boolean dispatch(Request request, final Response response)
                throws IOException
                // Only match the root path
                if (!request.getPath().equals("/"))
                    return false;
                if (_componentClassResolver.isPageName(_startPageName))
                    ActionResponseGenerator responseGenerator = _handler.handle(_startPageName,

                    if (responseGenerator != null)
                    return true;
                return false;

        // Looks for the root path and renders the start page
        configuration.add("RootPathFix", new RootPathDispatcherFix(componentClassResolver,
            pageRenderRequestHandler, pageResponseRenderer, startPageName), "before:RootPath");

Tapestry5RootPathEmptyResponse (last edited 2009-09-20 23:20:52 by localhost)