HttpServletResponse response,
Context ctx)
throws Exception {
Template outty = null;
RollerRequest rreq = null;
WebsiteData website = null;
PageContext pageContext =
JspFactory.getDefaultFactory().getPageContext(
this, request, response,"", true, 8192, true);
// first off lets parse the incoming request and validate it
try {
rreq = RollerRequest.getRollerRequest(pageContext);
} catch (Throwable t) {
// NOTE: indicates real problem, not just a "not found" error
throw new Exception("ERROR: creating RollerRequest");
}
// All pages exist within website, so website MUST be specified
website = rreq.getWebsite();
if (website == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
}
// request appears to be valid, lets render
try {
org.apache.roller.pojos.Template page = null;
// If this is a popup request, then deal with it specially
if(request.getParameter("popup") != null) {
try {
// Does user have a popupcomments page?
page = website.getPageByName("_popupcomments");
} catch(Exception e ) {
// ignored ... considered page not found
}
// User doesn't have one so return the default
if(page == null) {
page = new WeblogTemplate("/popupcomments.vm", website,
"Comments", "Comments", "dummy_link",
"dummy_template", new Date());
}
rreq.setPage(page);
// If request specified the page, then go with that
} else if (rreq.getPage() != null) {
page = rreq.getPage();
// If page not available from request, then use website's default
} else {
page = website.getDefaultPage();
rreq.setPage(page);
}
// Still no page ID, then we have a problem
if ( page == null ) {
throw new ResourceNotFoundException("Page not found");