HttpServletResponse response,
Context ctx)
throws IOException {
Template template = null;
WeblogRequest weblogRequest = null;
WebsiteData weblog = null;
// first off lets parse the incoming request and validate it
try {
weblogRequest = new WeblogRequest(request);
// now make sure the specified weblog really exists
UserManager userMgr = RollerFactory.getRoller().getUserManager();
weblog = userMgr.getWebsiteByHandle(weblogRequest.getWeblogHandle(), Boolean.TRUE);
} catch(InvalidRequestException ire) {
// An error initializing the request is considered to be a 404
response.sendError(HttpServletResponse.SC_NOT_FOUND);
request.setAttribute("DisplayException", ire);
mLogger.error("Bad Request: "+ire.getMessage());
return null;
} catch(RollerException re) {
// error looking up the weblog, we assume it doesn't exist
response.sendError(HttpServletResponse.SC_NOT_FOUND);
request.setAttribute("DisplayException", re);
mLogger.warn("Unable to lookup weblog ["+
weblogRequest.getWeblogHandle()+"] "+re.getMessage());
return null;
}