* the authoring/admin UI and one for rendering. it doesn't make
* sense for this strange intermixing to be happening.
*/
protected static WebsiteData getRequestedWeblog(HttpServletRequest request) throws RollerException {
WebsiteData weblog = null;
Roller roller = RollerFactory.getRoller();
// first check authoring form of URL
if (request.getParameter(RequestConstants.WEBLOG) != null) {
String weblogHandle = request.getParameter(RequestConstants.WEBLOG);
weblog = roller.getUserManager().getWebsiteByHandle(weblogHandle);
} else if (request.getParameter(RequestConstants.WEBLOG_ID) != null) {
String weblogId = request.getParameter(RequestConstants.WEBLOG_ID);
weblog = roller.getUserManager().getWebsite(weblogId);
} else if (request.getParameter(RequestConstants.WEBLOGENTRY_ID) != null) {
String entryId = request.getParameter(RequestConstants.WEBLOGENTRY_ID);
WeblogEntryData entry = roller.getWeblogManager().getWeblogEntry(entryId);
if(entry != null) {
weblog = entry.getWebsite();
}
} else if (request.getParameter(RequestConstants.WEBLOGCATEGORY_ID) != null) {
String catId = request.getParameter(RequestConstants.WEBLOGCATEGORY_ID);
WeblogCategoryData cat = roller.getWeblogManager().getWeblogCategory(catId);
if(cat != null) {
weblog = cat.getWebsite();
}
} else if (request.getParameter(RequestConstants.FOLDER_ID) != null) {
String folderId = request.getParameter(RequestConstants.FOLDER_ID);
FolderData folder = roller.getBookmarkManager().getFolder(folderId);
if(folder != null) {
weblog = folder.getWebsite();
}
} else if (request.getParameter(RequestConstants.BOOKMARK_ID) != null) {
String bookmarkId = request.getParameter(RequestConstants.BOOKMARK_ID);
BookmarkData bookmark = roller.getBookmarkManager().getBookmark(bookmarkId);
FolderData folder = bookmark.getFolder();
if(folder != null) {
weblog = folder.getWebsite();
}
} else if (request.getSession().getAttribute(RequestConstants.WEBLOG_SESSION_STASH) != null) {
String handle = (String)request.getSession().getAttribute(RequestConstants.WEBLOG_SESSION_STASH);
weblog = roller.getUserManager().getWebsiteByHandle(handle);
} else {
// check rendering system form of URL
// TODO: hack. we expect the parsed request as an HttpRequest attr
WeblogPageRequest pageRequest = (WeblogPageRequest) request.getAttribute("pageRequest");
if(pageRequest != null) {