String contentKey = path.getContentKey();
String jspName = path.getResourcePath();
if (database != null) {
WGContent content = null;
LanguageBehaviour langBehaviour = LanguageBehaviourTools.retrieve(database);
// Determine the content for this request
if (contentKey != null) {
content = getContentByAnyKey(contentKey, database, request);
if (content == null) {
if (request.getQueryString() != null && request.getQueryString().toLowerCase().indexOf("login") != -1) {
sendRedirect(response, getLoginURL(request, database, path.getCompleteURL()));
}
else {
throw new HttpErrorException(404, "No content of name/id " + contentKey, path.getDatabaseKey());
}
return;
}
if (!content.isVisible() && !isBrowserInterface(request.getSession())) {
throw new HttpErrorException(404, "No content of name/id " + contentKey, path.getDatabaseKey());
}
}
else {
WGLanguage lang = langBehaviour.requestSelectDatabaseLanguage(database, request);
content = database.getDummyContent(lang.getName());
}
// Test browsability of content
if (!content.isDummy() && getBrowsingSecurity(database) <= BrowsingSecurity.NO_BROWSING) {