Fixed bad cache because missing pathinfo parameters.

This commit is contained in:
Christian P. MOMON 2024-08-16 23:29:26 +02:00
parent e9e5bcebd7
commit f7eafcf23f
23 changed files with 314 additions and 281 deletions

View file

@ -64,9 +64,6 @@ public class CategoryPage extends HttpServlet
{
logger.info("PAGE Federation > Categories > Category");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -76,6 +73,10 @@ public class CategoryPage extends HttpServlet
UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal();
Category category = StatoolInfosWeb.instance().getCategoryFromPathinfo(request.getPathInfo());
String key = this.getClass().getCanonicalName() + "?category=" + category.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
// Send response.
// ==============
String headerView = FederationHeaderView.htmlize(federation, uptimes);
@ -89,7 +90,7 @@ public class CategoryPage extends HttpServlet
trail.add(category.getName(), "/federation/categories/" + category.getTechnicalName() + ".xhtml");
html = WebCharterView.build(headerView, contentView, trail);
StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html);
StatoolInfosWeb.instance().getHtmlCache().put(key, html);
}
// Display page.
@ -123,7 +124,7 @@ public class CategoryPage extends HttpServlet
TagDataManager data = new TagDataManager();
data.setAttribute("categoryLogo", "src", category.getLogoPath());
data.setAttribute("categoryLogo", "src", "/commons/categories/" + category.getLogoPath());
data.setEscapedContent("categoryName", category.getName());
data.setEscapedContent("categoryDescription", category.getDescription());
data.setEscapedContent("categorySoftwares", category.getSoftwares().sort().toStringWithFrenchCommas());

View file

@ -128,7 +128,8 @@ public class IndexPage extends HttpServlet
data.setEscapedContent("categoryListLine", index, "categoryListLineNameValue", stat.getCategory().getName());
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "href", stat.getCategory().getTechnicalName() + ".xhtml");
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription());
data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src", stat.getCategory().getLogoPath());
data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src",
"/commons/categories/" + stat.getCategory().getLogoPath());
data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares",
stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas());

View file

@ -56,9 +56,6 @@ public class CrawlPage extends HttpServlet
{
logger.info("PAGE Organization > Crawl");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -69,6 +66,10 @@ public class CrawlPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = CrawlView.htmlize(organization.getCrawlJournal());
@ -79,7 +80,7 @@ public class CrawlPage extends HttpServlet
trail.add("Journal", "/federation/organizations/" + organization.getTechnicalName() + "/crawl.xhtml");
html = WebCharterView.build(headerView, contentView, trail);
StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html);
StatoolInfosWeb.instance().getHtmlCache().put(key, html);
}
// Display page.

View file

@ -56,9 +56,6 @@ public class PropertyAlertPage extends HttpServlet
{
logger.info("PAGE Organization > PropertyAlert");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -69,6 +66,10 @@ public class PropertyAlertPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = PropertyAlertView.htmlize(organization.getInputChecksAll().getAlertLines());
@ -79,7 +80,7 @@ public class PropertyAlertPage extends HttpServlet
trail.add("Alertes", "/federation/organizations/" + organization.getTechnicalName() + "/propertyAlert.xhtml");
html = WebCharterView.build(headerView, contentView, trail);
StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html);
StatoolInfosWeb.instance().getHtmlCache().put(key, html);
}
// Display page.

View file

@ -56,9 +56,6 @@ public class PropertyCheckPage extends HttpServlet
{
logger.info("PAGE Organization > PropertyCheck");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -69,6 +66,10 @@ public class PropertyCheckPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = PropertyCheckView.htmlize(organization.getInputChecks());

View file

@ -56,19 +56,20 @@ public class ServicesPage extends HttpServlet
{
logger.info("PAGE Organization > Services");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
// Use parameters.
// ===============
Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo());
UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal();
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal();
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = ServiceListView.htmlize(organization.getServices());

View file

@ -64,9 +64,6 @@ public class StatsPage extends HttpServlet
{
logger.info("PAGE Organization > Stats");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -77,6 +74,10 @@ public class StatsPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = htmlize(organization);

View file

@ -56,9 +56,6 @@ public class UptimePage extends HttpServlet
{
logger.info("PAGE Organization > Uptime");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -69,6 +66,10 @@ public class UptimePage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = UptimeView.htmlize(organization.getServices(), uptimes);

View file

@ -66,9 +66,6 @@ public class MetricGenericPage extends HttpServlet
{
logger.info("PAGE Organization > Metrics > Summary");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -81,6 +78,10 @@ public class MetricGenericPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = htmlize(organization, viewMenu, periodMenu);

View file

@ -64,9 +64,6 @@ public class MetricSpecificPage extends HttpServlet
{
logger.info("PAGE Organization > Metrics > Specific");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -79,6 +76,10 @@ public class MetricSpecificPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = htmlize(organization, viewMenu, periodMenu);

View file

@ -66,9 +66,6 @@ public class MetricSummaryPage extends HttpServlet
{
logger.info("PAGE Organization > Metrics > Summary");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -81,6 +78,10 @@ public class MetricSummaryPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = htmlize(organization, viewMenu, periodMenu);

View file

@ -65,9 +65,6 @@ public class MetricWebPage extends HttpServlet
{
logger.info("PAGE Organization > Metrics > Web");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -80,6 +77,10 @@ public class MetricWebPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = OrganizationHeaderView.htmlize(organization, uptimes);
String contentView = htmlize(organization, viewMenu, periodMenu);

View file

@ -57,9 +57,6 @@ public class CrawlPage extends HttpServlet
{
logger.info("PAGE Service > Crawl");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -71,6 +68,11 @@ public class CrawlPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = CrawlView.htmlize(service.getCrawlJournal());

View file

@ -57,9 +57,6 @@ public class PropertyAlertPage extends HttpServlet
{
logger.info("PAGE Service > PropertyAlert");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -71,6 +68,11 @@ public class PropertyAlertPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = PropertyAlertView.htmlize(service.getInputChecksAll().getAlertLines());

View file

@ -57,9 +57,6 @@ public class PropertyCheckPage extends HttpServlet
{
logger.info("PAGE Service > PropertyCheck");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -71,6 +68,11 @@ public class PropertyCheckPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = PropertyCheckView.htmlize(service.getInputChecks());

View file

@ -58,9 +58,6 @@ public class ServicesPage extends HttpServlet
{
logger.info("PAGE Service > Services");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -72,6 +69,11 @@ public class ServicesPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = ServiceListView.htmlize(new Services(service));

View file

@ -65,9 +65,6 @@ public class StatsPage extends HttpServlet
{
logger.info("PAGE Service > Stats");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -79,6 +76,11 @@ public class StatsPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = htmlize(service);

View file

@ -58,9 +58,6 @@ public class UptimePage extends HttpServlet
{
logger.info("PAGE Service > Uptime");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -72,6 +69,11 @@ public class UptimePage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = UptimeView.htmlize(new Services(service), uptimeJournal);

View file

@ -67,9 +67,6 @@ public class MetricGenericPage extends HttpServlet
{
logger.info("PAGE Service > MetricGenericPage");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -83,6 +80,11 @@ public class MetricGenericPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = htmlize(service, viewMenu, periodMenu);

View file

@ -67,9 +67,6 @@ public class MetricSpecificPage extends HttpServlet
{
logger.info("PAGE Service > MetricGenericPage");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -83,6 +80,11 @@ public class MetricSpecificPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = htmlize(service, viewMenu, periodMenu);

View file

@ -67,9 +67,6 @@ public class MetricSummaryPage extends HttpServlet
{
logger.info("PAGE Service > MetricSummaryPage");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -83,6 +80,11 @@ public class MetricSummaryPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = htmlize(service, viewMenu, periodMenu);

View file

@ -67,9 +67,6 @@ public class MetricWebPage extends HttpServlet
{
logger.info("PAGE Service > MetricGenericPage");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -83,6 +80,11 @@ public class MetricWebPage extends HttpServlet
// Send response.
// ==============
String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service="
+ service.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
String headerView = ServiceHeaderView.htmlize(service, uptimeJournal);
String contentView = htmlize(service, viewMenu, periodMenu);

View file

@ -64,9 +64,6 @@ public class SoftwarePage extends HttpServlet
{
logger.info("PAGE Federation > Softwares > Software");
String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName());
if (html == null)
{
// Get parameters.
// ===============
@ -74,17 +71,21 @@ public class SoftwarePage extends HttpServlet
// ===============
Federation federation = StatoolInfosWeb.instance().getFederation();
UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal();
Software software = StatoolInfosWeb.instance().getSoftwareFromPathinfo(request.getPathInfo());
// Send response.
// ==============
String headerView = FederationHeaderView.htmlize(federation, uptimes);
Software software = StatoolInfosWeb.instance().getSoftwareFromPathinfo(request.getPathInfo());
if (software == null)
{
throw new StatoolInfosWebException("Illegal software name.");
}
else
{
String key = this.getClass().getCanonicalName() + "?software=" + software.getTechnicalName();
String html = StatoolInfosWeb.instance().getHtmlCache().get(key);
if (html == null)
{
Services services = federation.getServices().getBy(software);
String contentView = htmlize(software, services);
@ -94,7 +95,7 @@ public class SoftwarePage extends HttpServlet
trail.add("Logiciels", "/federation/softwares/");
html = WebCharterView.build(headerView, contentView, trail);
StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html);
StatoolInfosWeb.instance().getHtmlCache().put(key, html);
}
// Display page.