From f7eafcf23fe9afda24035e7535746775143e28ef Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 16 Aug 2024 23:29:26 +0200 Subject: [PATCH] Fixed bad cache because missing pathinfo parameters. --- .../federation/categories/CategoryPage.java | 25 +++++------ .../federation/categories/IndexPage.java | 3 +- .../organizations/organization/CrawlPage.java | 25 +++++------ .../organization/PropertyAlertPage.java | 25 +++++------ .../organization/PropertyCheckPage.java | 23 +++++----- .../organization/ServicesPage.java | 21 ++++----- .../organizations/organization/StatsPage.java | 23 +++++----- .../organization/UptimePage.java | 23 +++++----- .../metrics/MetricGenericPage.java | 27 ++++++------ .../metrics/MetricSpecificPage.java | 27 ++++++------ .../metrics/MetricSummaryPage.java | 27 ++++++------ .../organization/metrics/MetricWebPage.java | 27 ++++++------ .../services/service/CrawlPage.java | 26 +++++------ .../services/service/PropertyAlertPage.java | 26 +++++------ .../services/service/PropertyCheckPage.java | 26 +++++------ .../services/service/ServicesPage.java | 26 +++++------ .../services/service/StatsPage.java | 26 +++++------ .../services/service/UptimePage.java | 26 +++++------ .../service/metrics/MetricGenericPage.java | 30 +++++++------ .../service/metrics/MetricSpecificPage.java | 30 +++++++------ .../service/metrics/MetricSummaryPage.java | 30 +++++++------ .../service/metrics/MetricWebPage.java | 30 +++++++------ .../federation/softwares/SoftwarePage.java | 43 ++++++++++--------- 23 files changed, 314 insertions(+), 281 deletions(-) diff --git a/src/website/federation/categories/CategoryPage.java b/src/website/federation/categories/CategoryPage.java index 2bc0593..cbb4193 100644 --- a/src/website/federation/categories/CategoryPage.java +++ b/src/website/federation/categories/CategoryPage.java @@ -64,18 +64,19 @@ public class CategoryPage extends HttpServlet { logger.info("PAGE Federation > Categories > Category"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Federation federation = StatoolInfosWeb.instance().getFederation(); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - Category category = StatoolInfosWeb.instance().getCategoryFromPathinfo(request.getPathInfo()); - // 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()); diff --git a/src/website/federation/categories/IndexPage.java b/src/website/federation/categories/IndexPage.java index a42c523..3e35258 100644 --- a/src/website/federation/categories/IndexPage.java +++ b/src/website/federation/categories/IndexPage.java @@ -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()); diff --git a/src/website/federation/organizations/organization/CrawlPage.java b/src/website/federation/organizations/organization/CrawlPage.java index fad23b3..50f2ad9 100644 --- a/src/website/federation/organizations/organization/CrawlPage.java +++ b/src/website/federation/organizations/organization/CrawlPage.java @@ -56,19 +56,20 @@ public class CrawlPage extends HttpServlet { logger.info("PAGE Organization > Crawl"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== 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. diff --git a/src/website/federation/organizations/organization/PropertyAlertPage.java b/src/website/federation/organizations/organization/PropertyAlertPage.java index 42973e4..eeca89e 100644 --- a/src/website/federation/organizations/organization/PropertyAlertPage.java +++ b/src/website/federation/organizations/organization/PropertyAlertPage.java @@ -56,19 +56,20 @@ public class PropertyAlertPage extends HttpServlet { logger.info("PAGE Organization > PropertyAlert"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== 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. diff --git a/src/website/federation/organizations/organization/PropertyCheckPage.java b/src/website/federation/organizations/organization/PropertyCheckPage.java index 6008c8f..6927f8a 100644 --- a/src/website/federation/organizations/organization/PropertyCheckPage.java +++ b/src/website/federation/organizations/organization/PropertyCheckPage.java @@ -56,19 +56,20 @@ public class PropertyCheckPage extends HttpServlet { logger.info("PAGE Organization > PropertyCheck"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = PropertyCheckView.htmlize(organization.getInputChecks()); diff --git a/src/website/federation/organizations/organization/ServicesPage.java b/src/website/federation/organizations/organization/ServicesPage.java index 8a84150..63a0fe4 100644 --- a/src/website/federation/organizations/organization/ServicesPage.java +++ b/src/website/federation/organizations/organization/ServicesPage.java @@ -56,19 +56,20 @@ public class ServicesPage extends HttpServlet { logger.info("PAGE Organization > Services"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = ServiceListView.htmlize(organization.getServices()); diff --git a/src/website/federation/organizations/organization/StatsPage.java b/src/website/federation/organizations/organization/StatsPage.java index 661b057..0d7c0d5 100644 --- a/src/website/federation/organizations/organization/StatsPage.java +++ b/src/website/federation/organizations/organization/StatsPage.java @@ -64,19 +64,20 @@ public class StatsPage extends HttpServlet { logger.info("PAGE Organization > Stats"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = htmlize(organization); diff --git a/src/website/federation/organizations/organization/UptimePage.java b/src/website/federation/organizations/organization/UptimePage.java index 2f6db77..b0e2e19 100644 --- a/src/website/federation/organizations/organization/UptimePage.java +++ b/src/website/federation/organizations/organization/UptimePage.java @@ -56,19 +56,20 @@ public class UptimePage extends HttpServlet { logger.info("PAGE Organization > Uptime"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // 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) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = UptimeView.htmlize(organization.getServices(), uptimes); diff --git a/src/website/federation/organizations/organization/metrics/MetricGenericPage.java b/src/website/federation/organizations/organization/metrics/MetricGenericPage.java index 1073efc..aff789b 100644 --- a/src/website/federation/organizations/organization/metrics/MetricGenericPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricGenericPage.java @@ -66,21 +66,22 @@ public class MetricGenericPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Summary"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = htmlize(organization, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java b/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java index acda37a..c396f56 100644 --- a/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java @@ -64,21 +64,22 @@ public class MetricSpecificPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Specific"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = htmlize(organization, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java b/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java index 1e9b6df..032c8fb 100644 --- a/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java @@ -66,21 +66,22 @@ public class MetricSummaryPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Summary"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = htmlize(organization, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/metrics/MetricWebPage.java b/src/website/federation/organizations/organization/metrics/MetricWebPage.java index 5f08d3c..abd137d 100644 --- a/src/website/federation/organizations/organization/metrics/MetricWebPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricWebPage.java @@ -65,21 +65,22 @@ public class MetricWebPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Web"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Organization organization = StatoolInfosWeb.instance().getOrganizationFromPathinfo(request.getPathInfo()); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = OrganizationHeaderView.htmlize(organization, uptimes); String contentView = htmlize(organization, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/services/service/CrawlPage.java b/src/website/federation/organizations/organization/services/service/CrawlPage.java index dd865d8..5d63648 100644 --- a/src/website/federation/organizations/organization/services/service/CrawlPage.java +++ b/src/website/federation/organizations/organization/services/service/CrawlPage.java @@ -57,20 +57,22 @@ public class CrawlPage extends HttpServlet { logger.info("PAGE Service > Crawl"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = CrawlView.htmlize(service.getCrawlJournal()); diff --git a/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java b/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java index b295fe0..322c9a1 100644 --- a/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java +++ b/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java @@ -57,20 +57,22 @@ public class PropertyAlertPage extends HttpServlet { logger.info("PAGE Service > PropertyAlert"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = PropertyAlertView.htmlize(service.getInputChecksAll().getAlertLines()); diff --git a/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java b/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java index 9ab754c..b63b7ed 100644 --- a/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java +++ b/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java @@ -57,20 +57,22 @@ public class PropertyCheckPage extends HttpServlet { logger.info("PAGE Service > PropertyCheck"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = PropertyCheckView.htmlize(service.getInputChecks()); diff --git a/src/website/federation/organizations/organization/services/service/ServicesPage.java b/src/website/federation/organizations/organization/services/service/ServicesPage.java index 7a4ffd9..321bc17 100644 --- a/src/website/federation/organizations/organization/services/service/ServicesPage.java +++ b/src/website/federation/organizations/organization/services/service/ServicesPage.java @@ -58,20 +58,22 @@ public class ServicesPage extends HttpServlet { logger.info("PAGE Service > Services"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = ServiceListView.htmlize(new Services(service)); diff --git a/src/website/federation/organizations/organization/services/service/StatsPage.java b/src/website/federation/organizations/organization/services/service/StatsPage.java index 0689a6a..914852e 100644 --- a/src/website/federation/organizations/organization/services/service/StatsPage.java +++ b/src/website/federation/organizations/organization/services/service/StatsPage.java @@ -65,20 +65,22 @@ public class StatsPage extends HttpServlet { logger.info("PAGE Service > Stats"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = htmlize(service); diff --git a/src/website/federation/organizations/organization/services/service/UptimePage.java b/src/website/federation/organizations/organization/services/service/UptimePage.java index 80ab84a..9245636 100644 --- a/src/website/federation/organizations/organization/services/service/UptimePage.java +++ b/src/website/federation/organizations/organization/services/service/UptimePage.java @@ -58,20 +58,22 @@ public class UptimePage extends HttpServlet { logger.info("PAGE Service > Uptime"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = UptimeView.htmlize(new Services(service), uptimeJournal); diff --git a/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java b/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java index 62e066b..331f6c4 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java @@ -67,22 +67,24 @@ public class MetricGenericPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = htmlize(service, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java b/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java index ecba0fc..562e642 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java @@ -67,22 +67,24 @@ public class MetricSpecificPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = htmlize(service, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java b/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java index 08e5fc1..a7773c8 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java @@ -67,22 +67,24 @@ public class MetricSummaryPage extends HttpServlet { logger.info("PAGE Service > MetricSummaryPage"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = htmlize(service, viewMenu, periodMenu); diff --git a/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java b/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java index d3c36eb..eb9a4d1 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java @@ -67,22 +67,24 @@ public class MetricWebPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); + Organization organization = service.getOrganization(); + UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + + // Send response. + // ============== + String key = this.getClass().getCanonicalName() + "?organization=" + organization.getTechnicalName() + "&service=" + + service.getTechnicalName(); + String html = StatoolInfosWeb.instance().getHtmlCache().get(key); if (html == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - - // Send response. - // ============== String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); String contentView = htmlize(service, viewMenu, periodMenu); diff --git a/src/website/federation/softwares/SoftwarePage.java b/src/website/federation/softwares/SoftwarePage.java index bb5f754..8e9874b 100644 --- a/src/website/federation/softwares/SoftwarePage.java +++ b/src/website/federation/softwares/SoftwarePage.java @@ -64,27 +64,28 @@ 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. + // =============== + + // Use parameters. + // =============== + 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); + + if (software == null) { - // Get parameters. - // =============== - - // Use parameters. - // =============== - Federation federation = StatoolInfosWeb.instance().getFederation(); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // 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 + 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.