*/
protected BufferedWebResponse renderPage(Url targetUrl, RequestCycle requestCycle)
{
// get the page before checking for a scheduled request handler because
// the page may call setResponsePage in its constructor
IRequestablePage requestablePage = getPage();
IRequestHandler scheduled = requestCycle.getRequestHandlerScheduledAfterCurrent();
if (scheduled != null)
{
// no need to render
return null;
}
// keep the original response
final WebResponse originalResponse = (WebResponse)requestCycle.getResponse();
// buffered web response for page
BufferedWebResponse response = new BufferedWebResponse(originalResponse);
// keep the original base URL
Url originalBaseUrl = requestCycle.getUrlRenderer().setBaseUrl(targetUrl);
try
{
requestCycle.setResponse(response);
requestablePage.renderPage();
if (scheduled == null && requestCycle.getRequestHandlerScheduledAfterCurrent() != null)
{
// This is a special case.
// During page render another request handler got scheduled and will want to