You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2007/08/01 09:40:59 UTC
[Tapestry Wiki] Update of "Tapestry5RootPathEmptyResponse" by NickWestgate
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.
The following page has been changed by NickWestgate:
http://wiki.apache.org/tapestry/Tapestry5RootPathEmptyResponse
New page:
= A runtime patch for the root path empty response bug =
[https://issues.apache.org/jira/browse/TAPESTRY-1627 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.5, 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/1/8
public void contributeMasterDispatcher(
OrderedConfiguration<Dispatcher> configuration,
PageRenderRequestHandler pageRenderRequestHandler,
ComponentClassResolver componentClassResolver,
@Symbol("tapestry.start-page-name")
String startPageName,
@InjectService("PageResponseRenderer")
PageResponseRenderer pageResponseRenderer)
{
class RootPathDispatcherFix implements Dispatcher
{
private final ComponentClassResolver _componentClassResolver;
private final PageRenderRequestHandler _handler;
@SuppressWarnings("unused")
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,
_emptyContext);
if (responseGenerator != null)
responseGenerator.sendClientResponse(response);
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");
}
}}}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org