return super.handleRequest(request, response, ctx);
}
Template outty = null;
RollerRequest rreq = null;
// first off lets parse the incoming request and validate it
try {
PageContext pageContext =
JspFactory.getDefaultFactory().getPageContext(
this, request, response,"", true, 8192, true);
rreq = RollerRequest.getRollerRequest(pageContext);
} catch (RollerException e) {
// An error initializing the request is considered to be a 404
response.sendError(HttpServletResponse.SC_NOT_FOUND);
request.setAttribute("DisplayException", e);
return null;
}
// request appears to be valid, lets render
try {
UserManager userMgr = RollerFactory.getRoller().getUserManager();
WebsiteData website = null;
if (request.getAttribute(RollerRequest.OWNING_WEBSITE) != null)
{
UserData user = (UserData)
request.getAttribute(RollerRequest.OWNING_WEBSITE);
}
else
{
website = rreq.getWebsite();
}
// construct a temporary Website object for this request
// and set the EditorTheme to our previewTheme
WebsiteData tmpWebsite = new WebsiteData();
tmpWebsite.setData(website);
if(previewTheme != null)
tmpWebsite.setEditorTheme(previewTheme.getName());
else
tmpWebsite.setEditorTheme(Theme.CUSTOM);
org.apache.roller.pojos.Template page = null;
page = tmpWebsite.getDefaultPage();
// Still no page ID ... probably someone with no templates
// trying to preview a "custom" theme
if ( page == null ) {
// lets just call it a 404 and return
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
}
// update our roller request object
rreq.setPage(page);
rreq.setWebsite(tmpWebsite);
// this sets up the page we want to render
outty = prepareForPageExecution(ctx, rreq, response, page);
// if there is a decorator template then apply it