}
}
protected String innerBuildHomepageURL(WGDatabase db, HttpServletRequest request) throws WGException {
String homepage = (String) db.getAttribute(WGACore.DBATTRIB_HOME_PAGE);
WGACore core = WGACore.retrieve(request.getSession().getServletContext());
WGPDispatcher dispatcher = core.getDispatcher();
// First try: if db homepage attribute set - redirect to homepage
if (homepage != null && !homepage.trim().equals("")) {
return dispatcher.getPublisherURL(request) + "/" + db.getDbReference().toLowerCase() + "/" + homepage;
}
// Try to find a document named "home" in the relevant languages
db = core.openContentDB(db, request, false);
if (db.isSessionOpen()) {
LanguageBehaviour langBehaviour = LanguageBehaviourTools.retrieve(db);
WGContent content = langBehaviour.requestSelectContentForName(db, request, "home", false);
if (content != null && content.mayBePublished(false, WGContent.DISPLAYTYPE_NONE)) {