diff --git a/src/website/federation/CrawlPage.java b/src/website/federation/CrawlPage.java index 4aeba0c..b499786 100644 --- a/src/website/federation/CrawlPage.java +++ b/src/website/federation/CrawlPage.java @@ -52,24 +52,29 @@ public class CrawlPage extends HttpServlet { try { - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = CrawlView.htmlize(federation.getCrawlJournal()); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = CrawlView.htmlize(federation.getCrawlJournal()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Journal", "/federation/crawl.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Journal", "/federation/crawl.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/LastStatsPage.java b/src/website/federation/LastStatsPage.java index 5b78e20..450b806 100644 --- a/src/website/federation/LastStatsPage.java +++ b/src/website/federation/LastStatsPage.java @@ -54,24 +54,29 @@ public class LastStatsPage extends HttpServlet { logger.info("PAGE Federation > Last Stats"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = LastStatsView.htmlize(federation.getServices()); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = LastStatsView.htmlize(federation.getServices()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Chiffres", "/federation/servicesFigures.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Chiffres", "/federation/servicesFigures.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertiesFilesPage.java b/src/website/federation/PropertiesFilesPage.java index df5f855..bc41aff 100644 --- a/src/website/federation/PropertiesFilesPage.java +++ b/src/website/federation/PropertiesFilesPage.java @@ -63,26 +63,31 @@ public class PropertiesFilesPage extends HttpServlet { logger.info("PAGE Federation > propertiesFiles"); - // Get parameters. - // =============== + 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(); - CrawlCache cache = StatoolInfosWeb.instance().getCache(); - PropertiesFileStats stats = StatAgent.statAllPropertiesFiles(federation, cache).sortByName(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + CrawlCache cache = StatoolInfosWeb.instance().getCache(); + PropertiesFileStats stats = StatAgent.statAllPropertiesFiles(federation, cache).sortByName(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(stats); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Fichiers", "/federation/propertiesFiles.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Fichiers", "/federation/propertiesFiles.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -129,7 +134,8 @@ public class PropertiesFilesPage extends HttpServlet data.setAttribute("fileListLine", index, "fileListLineNameLink", "href", stat.getURLName()); data.setEscapedContent("fileListLine", index, "fileListLineNameLink", stat.getURLName()); - data.setAttribute("fileListLine", index, "fileListLineOwnerLink", "href", "/federation/organizations/" + stat.getOrganization().getTechnicalName() + "/"); + data.setAttribute("fileListLine", index, "fileListLineOwnerLink", "href", + "/federation/organizations/" + stat.getOrganization().getTechnicalName() + "/"); data.setEscapedContent("fileListLine", index, "fileListLineNameValue", stat.getOrganization().getName()); data.setAttribute("fileListLine", index, "fileListLineOwnerLogo", "src", stat.getOrganization().getLogoFileName()); @@ -142,7 +148,8 @@ public class PropertiesFilesPage extends HttpServlet String propertyCheckURL; if (stat.getService() != null) { - propertyCheckURL = "/federation/organizations/" + stat.getOrganization().getTechnicalName() + "/services/" + stat.getService().getTechnicalName() + "/propertyCheck.xhtml"; + propertyCheckURL = "/federation/organizations/" + stat.getOrganization().getTechnicalName() + "/services/" + + stat.getService().getTechnicalName() + "/propertyCheck.xhtml"; } else if (stat.getOrganization() != null) { @@ -188,7 +195,8 @@ public class PropertiesFilesPage extends HttpServlet } data.setContent("fileListLine", index, "fileListLineDate", stat.getUpdateDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY"))); - data.setAttribute("fileListLine", index, "fileListLineDate", "title", stat.getUpdateDate().format(DateTimeFormatter.ofPattern("HH:mm:ss"))); + data.setAttribute("fileListLine", index, "fileListLineDate", "title", + stat.getUpdateDate().format(DateTimeFormatter.ofPattern("HH:mm:ss"))); index += 1; } diff --git a/src/website/federation/PropertyAlertFederationPage.java b/src/website/federation/PropertyAlertFederationPage.java index 00b1e13..a430922 100644 --- a/src/website/federation/PropertyAlertFederationPage.java +++ b/src/website/federation/PropertyAlertFederationPage.java @@ -56,26 +56,31 @@ public class PropertyAlertFederationPage extends HttpServlet { logger.info("PAGE Fédération > PropertyAlert"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); - PropertyChecks checks = federation.getInputChecks().getAlertLines(); - String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); + PropertyChecks checks = federation.getInputChecks().getAlertLines(); + String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); - trail.add("Disponibilités", "/federation/uptimes.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); + trail.add("Disponibilités", "/federation/uptimes.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyAlertOrganizationsPage.java b/src/website/federation/PropertyAlertOrganizationsPage.java index 5007713..b5cca3c 100644 --- a/src/website/federation/PropertyAlertOrganizationsPage.java +++ b/src/website/federation/PropertyAlertOrganizationsPage.java @@ -57,30 +57,35 @@ public class PropertyAlertOrganizationsPage extends HttpServlet { logger.info("PAGE Fédération > PropertyAlert"); - // Get parameters. - // =============== - - // Use parameters. - // =============== - Federation federation = StatoolInfosWeb.instance().getFederation(); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - - PropertyChecks checks = new PropertyChecks(); - for (Organization organization : federation.getOrganizations()) + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) { - checks.addAll(organization.getInputChecks().getAlertLines()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + + PropertyChecks checks = new PropertyChecks(); + for (Organization organization : federation.getOrganizations()) + { + checks.addAll(organization.getInputChecks().getAlertLines()); + } + String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); + trail.add("Disponibilités", "/federation/uptimes.xhtml"); + + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); } - String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); - - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); - trail.add("Disponibilités", "/federation/uptimes.xhtml"); - - String html = WebCharterView.build(headerView, contentView, trail); // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyAlertPage.java b/src/website/federation/PropertyAlertPage.java index db5858f..e276a9d 100644 --- a/src/website/federation/PropertyAlertPage.java +++ b/src/website/federation/PropertyAlertPage.java @@ -56,26 +56,31 @@ public class PropertyAlertPage extends HttpServlet { logger.info("PAGE Fédération > PropertyAlerts"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); - PropertyChecks checks = federation.getInputChecksAll().getAlertLines(); - String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); + PropertyChecks checks = federation.getInputChecksAll().getAlertLines(); + String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); - trail.add("Alertes", "/federation/propertyAlerts.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); + trail.add("Alertes", "/federation/propertyAlerts.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyAlertServicesPage.java b/src/website/federation/PropertyAlertServicesPage.java index f950ef4..3ccd677 100644 --- a/src/website/federation/PropertyAlertServicesPage.java +++ b/src/website/federation/PropertyAlertServicesPage.java @@ -57,30 +57,35 @@ public class PropertyAlertServicesPage extends HttpServlet { logger.info("PAGE Fédération > PropertyAlert"); - // Get parameters. - // =============== - - // Use parameters. - // =============== - Federation federation = StatoolInfosWeb.instance().getFederation(); - UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - - PropertyChecks checks = new PropertyChecks(); - for (Service service : federation.getServicesAll()) + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) { - checks.addAll(service.getInputChecksAll().getAlertLines()); + // Get parameters. + // =============== + + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + + PropertyChecks checks = new PropertyChecks(); + for (Service service : federation.getServicesAll()) + { + checks.addAll(service.getInputChecksAll().getAlertLines()); + } + String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Disponibilités", "/federation/uptimes.xhtml"); + + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); } - String contentView = PropertyAlertView.htmlize(checks, MenuOption.ON); - - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Disponibilités", "/federation/uptimes.xhtml"); - - String html = WebCharterView.build(headerView, contentView, trail); // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyCheckPage.java b/src/website/federation/PropertyCheckPage.java index 4fe06b2..d9115e8 100644 --- a/src/website/federation/PropertyCheckPage.java +++ b/src/website/federation/PropertyCheckPage.java @@ -52,24 +52,29 @@ public class PropertyCheckPage extends HttpServlet { try { - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PropertyCheckView.htmlize(federation.getInputChecks()); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PropertyCheckView.htmlize(federation.getInputChecks()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Propriétés", "/federation/propertyCheck.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Propriétés", "/federation/propertyCheck.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyStatsFederationPage.java b/src/website/federation/PropertyStatsFederationPage.java index d8265f5..5fe2ce7 100644 --- a/src/website/federation/PropertyStatsFederationPage.java +++ b/src/website/federation/PropertyStatsFederationPage.java @@ -56,25 +56,30 @@ public class PropertyStatsFederationPage extends HttpServlet { logger.info("PAGE Federation > propertiesStats"); - // Get parameters. - // =============== + 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(); - PropertyStats stats = StatAgent.statFederationProperties(federation); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + PropertyStats stats = StatAgent.statFederationProperties(federation); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PropertyStatsView.htmlize("Les propriétés de la fédération", stats); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PropertyStatsView.htmlize("Les propriétés de la fédération", stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Propriétés", "/federation/propertiesStats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Propriétés", "/federation/propertiesStats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyStatsOrganizationsPage.java b/src/website/federation/PropertyStatsOrganizationsPage.java index f8c7252..24767f7 100644 --- a/src/website/federation/PropertyStatsOrganizationsPage.java +++ b/src/website/federation/PropertyStatsOrganizationsPage.java @@ -56,25 +56,30 @@ public class PropertyStatsOrganizationsPage extends HttpServlet { logger.info("PAGE Federation > propertiesStats"); - // Get parameters. - // =============== + 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(); - PropertyStats stats = StatAgent.statOrganizationsProperties(federation.getActiveOrganizations()); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + PropertyStats stats = StatAgent.statOrganizationsProperties(federation.getActiveOrganizations()); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PropertyStatsView.htmlize("Les propriétés des organisations", stats); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PropertyStatsView.htmlize("Les propriétés des organisations", stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Propriétés", "/federation/propertiesStats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Propriétés", "/federation/propertiesStats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyStatsPage.java b/src/website/federation/PropertyStatsPage.java index cd8edff..441c5fe 100644 --- a/src/website/federation/PropertyStatsPage.java +++ b/src/website/federation/PropertyStatsPage.java @@ -57,26 +57,31 @@ public class PropertyStatsPage extends HttpServlet { logger.info("PAGE Federation > propertiesStats"); - // Get parameters. - // =============== + 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(); - CrawlCache cache = StatoolInfosWeb.instance().getCache(); - PropertyStats stats = StatAgent.statAllProperties(federation); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + CrawlCache cache = StatoolInfosWeb.instance().getCache(); + PropertyStats stats = StatAgent.statAllProperties(federation); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PropertyStatsView.htmlize("Toutes les propriétés", stats); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PropertyStatsView.htmlize("Toutes les propriétés", stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Propriétés", "/federation/propertiesStats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Propriétés", "/federation/propertiesStats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/PropertyStatsServicesPage.java b/src/website/federation/PropertyStatsServicesPage.java index a8edfdf..902a727 100644 --- a/src/website/federation/PropertyStatsServicesPage.java +++ b/src/website/federation/PropertyStatsServicesPage.java @@ -56,25 +56,30 @@ public class PropertyStatsServicesPage extends HttpServlet { logger.info("PAGE Federation > propertiesStats"); - // Get parameters. - // =============== + 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(); - PropertyStats stats = StatAgent.statServicesProperties(federation.getActiveServices()); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + PropertyStats stats = StatAgent.statServicesProperties(federation.getActiveServices()); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PropertyStatsView.htmlize("Les propriétés des services", stats); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PropertyStatsView.htmlize("Les propriétés des services", stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Propriétés", "/federation/propertiesStats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Propriétés", "/federation/propertiesStats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/ServicesPage.java b/src/website/federation/ServicesPage.java index fd6f308..035449e 100644 --- a/src/website/federation/ServicesPage.java +++ b/src/website/federation/ServicesPage.java @@ -54,24 +54,29 @@ public class ServicesPage extends HttpServlet { logger.info("PAGE Federation > services"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = ServiceListView.htmlize(federation.getServices()); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = ServiceListView.htmlize(federation.getServices()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Services", "/federation/services.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Services", "/federation/services.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/SocialNetworksPage.java b/src/website/federation/SocialNetworksPage.java index 138dfb5..a0230cf 100644 --- a/src/website/federation/SocialNetworksPage.java +++ b/src/website/federation/SocialNetworksPage.java @@ -62,26 +62,31 @@ public class SocialNetworksPage extends HttpServlet { logger.info("PAGE Federation > SocialNetworks"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); - Organizations organizations = federation.getOrganizations().filterBySocialNetworks(); - String contentView = htmlize("Réseaux sociaux", organizations); + Organizations organizations = federation.getOrganizations().filterBySocialNetworks(); + String contentView = htmlize("Réseaux sociaux", organizations); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Réseaux sociaux", "/federation/socialNetworks.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Réseaux sociaux", "/federation/socialNetworks.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -134,7 +139,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getDiasporaWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLineDiasporaImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLineDiasporaImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLineDiasporaImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLineDiasporaLink", "href", organization.getDiasporaWebpage()); data.setAttribute("organizationListLine", index, "organizationListLineDiaspora", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLineDiaspora", "data-order", "1"); @@ -143,7 +149,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getFunkwhaleWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLineFunkwhaleImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLineFunkwhaleImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLineFunkwhaleImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLineFunkwhaleLink", "href", organization.getFunkwhaleWebpage()); data.setAttribute("organizationListLine", index, "organizationListLineFunkwhale", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLineFunkwhale", "data-order", "1"); @@ -152,7 +159,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getMastodonWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLineMastodonImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLineMastodonImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLineMastodonImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLineMastodonLink", "href", organization.getMastodonWebpage()); data.setAttribute("organizationListLine", index, "organizationListLineMastodon", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLineMastodon", "data-order", "1"); @@ -161,7 +169,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getMobilizonWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLineMobilizonImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLineMobilizonImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLineMobilizonImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLineMobilizonLink", "href", organization.getMobilizonWebpage()); data.setAttribute("organizationListLine", index, "organizationListLineMobilizon", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLineMobilizon", "data-order", "1"); @@ -170,7 +179,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getPixelfedWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLinePixelfedImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLinePixelfedImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLinePixelfedImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLinePixelfedLink", "href", organization.getPixelfedWebpage()); data.setAttribute("organizationListLine", index, "organizationListLinePixelfed", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLinePixelfed", "data-order", "1"); @@ -179,7 +189,8 @@ public class SocialNetworksPage extends HttpServlet if (StringUtils.isNotBlank(organization.getPeertubeWebpage())) { data.setAttribute("organizationListLine", index, "organizationListLinePeertubeImg", "class", ""); - data.getIdData("organizationListLine", index, "organizationListLinePeertubeImg").getAttribute("class").setMode(DisplayMode.REPLACE); + data.getIdData("organizationListLine", index, "organizationListLinePeertubeImg").getAttribute("class") + .setMode(DisplayMode.REPLACE); data.setAttribute("organizationListLine", index, "organizationListLinePeertubeLink", "href", organization.getPeertubeWebpage()); data.setAttribute("organizationListLine", index, "organizationListLinePeertube", "data-search", "1"); data.setAttribute("organizationListLine", index, "organizationListLinePeertube", "data-order", "1"); diff --git a/src/website/federation/StatsPage.java b/src/website/federation/StatsPage.java index 7aa905a..023ec9b 100644 --- a/src/website/federation/StatsPage.java +++ b/src/website/federation/StatsPage.java @@ -63,25 +63,30 @@ public class StatsPage extends HttpServlet { logger.info("PAGE Federation > Stats"); - // Get parameters. - // =============== + 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(); - Categories categories = StatoolInfosWeb.instance().getCategories(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + Categories categories = StatoolInfosWeb.instance().getCategories(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(federation, categories); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(federation, categories); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Stats", "/federation/stats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Stats", "/federation/stats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/UptimePage.java b/src/website/federation/UptimePage.java index 109cc34..6b53b22 100644 --- a/src/website/federation/UptimePage.java +++ b/src/website/federation/UptimePage.java @@ -54,24 +54,29 @@ public class UptimePage extends HttpServlet { logger.info("PAGE Fédération > Uptimes"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = UptimeView.htmlize(federation.getActiveServices(), uptimes); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = UptimeView.htmlize(federation.getActiveServices(), uptimes); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Disponibilités", "/federation/uptimes.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Disponibilités", "/federation/uptimes.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/categories/CategoryPage.java b/src/website/federation/categories/CategoryPage.java index 3b296cc..2bc0593 100644 --- a/src/website/federation/categories/CategoryPage.java +++ b/src/website/federation/categories/CategoryPage.java @@ -64,28 +64,33 @@ public class CategoryPage extends HttpServlet { logger.info("PAGE Federation > Categories > Category"); - // Get parameters. - // =============== + 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(); - Category category = StatoolInfosWeb.instance().getCategoryFromPathinfo(request.getPathInfo()); + // 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); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); - Services services = federation.getServices().getBy(category); - String contentView = htmlize(category, services); + Services services = federation.getServices().getBy(category); + String contentView = htmlize(category, services); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Catégories", "/federation/categories/"); - trail.add(category.getName(), "/federation/categories/" + category.getTechnicalName() + ".xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Catégories", "/federation/categories/"); + trail.add(category.getName(), "/federation/categories/" + category.getTechnicalName() + ".xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/categories/IndexPage.java b/src/website/federation/categories/IndexPage.java index 64355d8..a42c523 100644 --- a/src/website/federation/categories/IndexPage.java +++ b/src/website/federation/categories/IndexPage.java @@ -64,27 +64,32 @@ public class IndexPage extends HttpServlet { logger.info("PAGE Federation > Categories"); - // Get parameters. - // =============== + 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(); - Categories categories = StatoolInfosWeb.instance().getCategories(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + Categories categories = StatoolInfosWeb.instance().getCategories(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); - CategoryStats stats = StatAgent.statAllCategories(federation, categories); - String contentView = htmlize(stats); + CategoryStats stats = StatAgent.statAllCategories(federation, categories); + String contentView = htmlize(stats); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Catégories", "/federation/categories/"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Catégories", "/federation/categories/"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -125,9 +130,11 @@ public class IndexPage extends HttpServlet data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription()); data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src", stat.getCategory().getLogoPath()); - data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas()); + data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", + stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas()); data.setContent("categoryListLine", index, "categoryListLineOrganizationCount", stat.getOrganizationCount()); - data.setContent("categoryListLine", index, "categoryListLineServiceCount", StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿")); + data.setContent("categoryListLine", index, "categoryListLineServiceCount", + StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿")); data.setContent("categoryListLine", index, "categoryListLineUserCount", StatoolInfosUtils.defaultIfZero(stat.getUserCount(), "😢")); data.setContent("categoryListLine", index, "categoryListLineVisitCount", StatoolInfosUtils.defaultIfZero(stat.getVisitCount(), "😞")); diff --git a/src/website/federation/exports/IndexPage.java b/src/website/federation/exports/IndexPage.java index 82c9cc9..eb985b9 100644 --- a/src/website/federation/exports/IndexPage.java +++ b/src/website/federation/exports/IndexPage.java @@ -57,24 +57,29 @@ public class IndexPage extends HttpServlet { logger.info("PAGE Fédération > Exports"); - // Get parameters. - // =============== + 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(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = PresenterUtils.dynamize("/website/federation/exports/index.xhtml", null).toString(); - contentView = XidynUtils.extractBodyContent(contentView); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = PresenterUtils.dynamize("/website/federation/exports/index.xhtml", null).toString(); + contentView = XidynUtils.extractBodyContent(contentView); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); - trail.add("Exports", "/federation/exports/"); - String html = WebCharterView.build(headerView, contentView, trail); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/organizations/"); + trail.add("Exports", "/federation/exports/"); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/metrics/MetricGenericPage.java b/src/website/federation/metrics/MetricGenericPage.java index 4c4be5b..f944640 100644 --- a/src/website/federation/metrics/MetricGenericPage.java +++ b/src/website/federation/metrics/MetricGenericPage.java @@ -65,27 +65,32 @@ public class MetricGenericPage extends HttpServlet { logger.info("PAGE Federation > Metrics > Generic"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(federation, viewMenu, periodMenu); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(federation, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Métriques", "/federation/metrics/"); - trail.add("Génériques", "/federation/metrics/generic.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Métriques", "/federation/metrics/"); + trail.add("Génériques", "/federation/metrics/generic.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -123,19 +128,23 @@ public class MetricGenericPage extends HttpServlet // data.setContent("graphic.users", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.users", ChartColor.GREEN)); - data.setContent("graphic.users.ipv4-ipv6", MetricHtmlizer.htmlize(federation, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW, - "metrics.service.users.ipv6", ChartColor.GREEN)); + data.setContent("graphic.users.ipv4-ipv6", MetricHtmlizer.htmlize(federation, view, period, "service.users (ipv4 + ipv6)", + "metrics.service.users.ipv4", ChartColor.YELLOW, "metrics.service.users.ipv6", ChartColor.GREEN)); data.setContent("graphic.users.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW)); data.setContent("graphic.users.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.users.ipv6", ChartColor.GREEN)); data.setContent("graphic.accounts", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.accounts", ChartColor.GREEN)); - data.setContent("graphic.accounts.active", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); + data.setContent("graphic.accounts.active", + MetricHtmlizer.htmlize(federation, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); - data.setContent("graphic.database.bytes", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); - data.setContent("graphic.datafiles.bytes", MetricHtmlizer.htmlize(federation, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); + data.setContent("graphic.database.bytes", + MetricHtmlizer.htmlize(federation, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); + data.setContent("graphic.datafiles.bytes", + MetricHtmlizer.htmlize(federation, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/metrics/MetricSpecificPage.java b/src/website/federation/metrics/MetricSpecificPage.java index e803183..2c1f862 100644 --- a/src/website/federation/metrics/MetricSpecificPage.java +++ b/src/website/federation/metrics/MetricSpecificPage.java @@ -65,27 +65,32 @@ public class MetricSpecificPage extends HttpServlet { logger.info("PAGE Federation > Metrics > Specific"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(federation, viewMenu, periodMenu); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(federation, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Métriques", "/federation/metrics/"); - trail.add("Spécifiques", "/federation/metrics/specific.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Métriques", "/federation/metrics/"); + trail.add("Spécifiques", "/federation/metrics/specific.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -122,7 +127,8 @@ public class MetricSpecificPage extends HttpServlet data.setContent("metricMenuView", MetricMenuView.htmlize(TypeMenu.SPECIFIC, view, period)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/metrics/MetricSummaryPage.java b/src/website/federation/metrics/MetricSummaryPage.java index 3e43410..7e6082c 100644 --- a/src/website/federation/metrics/MetricSummaryPage.java +++ b/src/website/federation/metrics/MetricSummaryPage.java @@ -66,27 +66,32 @@ public class MetricSummaryPage extends HttpServlet { logger.info("PAGE Federation > Metrics > Summary"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(federation, viewMenu, periodMenu); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(federation, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Métriques", "/federation/metrics/"); - trail.add("Résumé", "/federation/metrics/summary.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Métriques", "/federation/metrics/"); + trail.add("Résumé", "/federation/metrics/summary.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -129,7 +134,8 @@ public class MetricSummaryPage extends HttpServlet data.setContent("http.visits", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visits", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/metrics/MetricWebPage.java b/src/website/federation/metrics/MetricWebPage.java index f954dd1..12a6451 100644 --- a/src/website/federation/metrics/MetricWebPage.java +++ b/src/website/federation/metrics/MetricWebPage.java @@ -65,27 +65,32 @@ public class MetricWebPage extends HttpServlet { logger.info("PAGE Federation > Metrics > Web"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); + PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); - // Send response. - // ============== - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(federation, viewMenu, periodMenu); + // Send response. + // ============== + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(federation, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Métriques", "/federation/metrics/"); - trail.add("Web", "/federation/metrics/web.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Métriques", "/federation/metrics/"); + trail.add("Web", "/federation/metrics/web.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -124,22 +129,22 @@ public class MetricWebPage extends HttpServlet // data.setContent("http.hits", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits", ChartColor.BLUE)); - data.setContent("http.hits-ipv4ipv6", - MetricHtmlizer.htmlize(federation, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6", - ChartColor.GREEN)); + data.setContent("http.hits-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.hits (ipv4 + ipv6)", + "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6", ChartColor.GREEN)); data.setContent("http.hits.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW)); data.setContent("http.hits.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN)); - data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(federation, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN, - "metrics.http.hits.bots", ChartColor.YELLOW)); + data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(federation, view, period, "http.hits (humans + bots)", + "metrics.http.hits.humans", ChartColor.GREEN, "metrics.http.hits.bots", ChartColor.YELLOW)); data.setContent("http.hits.humans", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.humans", ChartColor.GREEN)); data.setContent("http.hits.bots", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.bots", ChartColor.YELLOW)); - data.setContent("http.hits.humans-ipv4ipv6", - MetricHtmlizer.htmlize(federation, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, - "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); - data.setContent("http.hits.humans.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); - data.setContent("http.hits.humans.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.hits.humans (ipv4 + ipv6)", + "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans.ipv4", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); + data.setContent("http.hits.humans.ipv6", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); data.setContent("http.errors", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.errors", ChartColor.RED)); data.setContent("http.errors.php", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.errors.php", ChartColor.RED)); @@ -150,43 +155,47 @@ public class MetricWebPage extends HttpServlet data.setContent("http.ip", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.ip", ChartColor.BLUE)); - data.setContent("http.ip-humansbots", - MetricHtmlizer.htmlize(federation, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots", ChartColor.YELLOW)); + data.setContent("http.ip-humansbots", MetricHtmlizer.htmlize(federation, view, period, "http.ip (humans + bots)", + "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots", ChartColor.YELLOW)); data.setContent("http.ip.humans", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.ip.humans", ChartColor.GREEN)); data.setContent("http.ip.bots", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.ip.bots", ChartColor.YELLOW)); - data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6", - ChartColor.GREEN)); + data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", + ChartColor.YELLOW, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.ip.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW)); data.setContent("http.ip.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.requesters", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters", ChartColor.BLUE)); - data.setContent("http.requesters-humansbots", - MetricHtmlizer.htmlize(federation, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, - "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters.humans", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); - data.setContent("http.requesters.bots", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW)); + data.setContent("http.requesters-humansbots", MetricHtmlizer.htmlize(federation, view, period, "http.requesters (humans + bots)", + "metrics.http.requesters.humans", ChartColor.GREEN, "metrics.http.requesters.bots", ChartColor.YELLOW)); + data.setContent("http.requesters.humans", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); + data.setContent("http.requesters.bots", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, - "metrics.http.requesters.ipv6", ChartColor.GREEN)); - data.setContent("http.requesters.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW)); - data.setContent("http.requesters.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN)); + data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.requesters (ipv4 + ipv6)", + "metrics.http.requesters.ipv4", ChartColor.YELLOW, "metrics.http.requesters.ipv6", ChartColor.GREEN)); + data.setContent("http.requesters.ipv4", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW)); + data.setContent("http.requesters.ipv6", + MetricHtmlizer.htmlize(federation, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN)); data.setContent("http.visitors", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visitors", ChartColor.BLUE)); - data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, - "metrics.http.visitors.ipv6", ChartColor.GREEN)); + data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.visitors (ipv4 + ipv6)", + "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN)); data.setContent("http.visitors.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW)); data.setContent("http.visitors.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN)); data.setContent("http.visits", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visits", ChartColor.BLUE)); - data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, - "metrics.http.visits.ipv6", ChartColor.GREEN)); + data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(federation, view, period, "http.visits (ipv4 + ipv6)", + "metrics.http.visits.ipv4", ChartColor.YELLOW, "metrics.http.visits.ipv6", ChartColor.GREEN)); data.setContent("http.visits.ipv4", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW)); data.setContent("http.visits.ipv6", MetricHtmlizer.htmlize(federation, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/IndexPage.java b/src/website/federation/organizations/IndexPage.java index 5ea7b73..1af7d2a 100644 --- a/src/website/federation/organizations/IndexPage.java +++ b/src/website/federation/organizations/IndexPage.java @@ -52,7 +52,7 @@ public class IndexPage extends HttpServlet { try { - String html = StatoolInfosWeb.instance().getHtmlCache().get(IndexPage.class.getCanonicalName()); + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); if (html == null) { // Get parameters. @@ -73,7 +73,7 @@ public class IndexPage extends HttpServlet trail.add("Organisations", "/federation/organizations/"); html = WebCharterView.build(headerView, contentView, trail); - StatoolInfosWeb.instance().getHtmlCache().put(IndexPage.class.getCanonicalName(), html); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); } // Display page. diff --git a/src/website/federation/organizations/organization/CrawlPage.java b/src/website/federation/organizations/organization/CrawlPage.java index 33a852c..fad23b3 100644 --- a/src/website/federation/organizations/organization/CrawlPage.java +++ b/src/website/federation/organizations/organization/CrawlPage.java @@ -56,26 +56,31 @@ public class CrawlPage extends HttpServlet { logger.info("PAGE Organization > Crawl"); - // Get parameters. - // =============== + 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(); + // 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()); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = CrawlView.htmlize(organization.getCrawlJournal()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Journal", "/federation/organizations/" + organization.getTechnicalName() + "/crawl.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Journal", "/federation/organizations/" + organization.getTechnicalName() + "/crawl.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/PropertyAlertPage.java b/src/website/federation/organizations/organization/PropertyAlertPage.java index b14a205..42973e4 100644 --- a/src/website/federation/organizations/organization/PropertyAlertPage.java +++ b/src/website/federation/organizations/organization/PropertyAlertPage.java @@ -56,26 +56,31 @@ public class PropertyAlertPage extends HttpServlet { logger.info("PAGE Organization > PropertyAlert"); - // Get parameters. - // =============== + 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(); + // 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()); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = PropertyAlertView.htmlize(organization.getInputChecksAll().getAlertLines()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Alertes", "/federation/organizations/" + organization.getTechnicalName() + "/propertyAlert.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Alertes", "/federation/organizations/" + organization.getTechnicalName() + "/propertyAlert.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/PropertyCheckPage.java b/src/website/federation/organizations/organization/PropertyCheckPage.java index 137e63a..6008c8f 100644 --- a/src/website/federation/organizations/organization/PropertyCheckPage.java +++ b/src/website/federation/organizations/organization/PropertyCheckPage.java @@ -56,26 +56,31 @@ public class PropertyCheckPage extends HttpServlet { logger.info("PAGE Organization > PropertyCheck"); - // Get parameters. - // =============== + 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(); + // 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()); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = PropertyCheckView.htmlize(organization.getInputChecks()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Propriétés", "/federation/organizations/" + organization.getTechnicalName() + "/propertyCheck.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Propriétés", "/federation/organizations/" + organization.getTechnicalName() + "/propertyCheck.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/ServicesPage.java b/src/website/federation/organizations/organization/ServicesPage.java index bf9c734..8a84150 100644 --- a/src/website/federation/organizations/organization/ServicesPage.java +++ b/src/website/federation/organizations/organization/ServicesPage.java @@ -56,26 +56,31 @@ public class ServicesPage extends HttpServlet { logger.info("PAGE Organization > Services"); - // Get parameters. - // =============== + 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(); + // 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()); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = ServiceListView.htmlize(organization.getServices()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/StatsPage.java b/src/website/federation/organizations/organization/StatsPage.java index 7cf5c7b..661b057 100644 --- a/src/website/federation/organizations/organization/StatsPage.java +++ b/src/website/federation/organizations/organization/StatsPage.java @@ -64,26 +64,31 @@ public class StatsPage extends HttpServlet { logger.info("PAGE Organization > Stats"); - // Get parameters. - // =============== + 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(); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = htmlize(organization); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Stats", "/federation/organizations/" + organization.getTechnicalName() + "/stats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Stats", "/federation/organizations/" + organization.getTechnicalName() + "/stats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/UptimePage.java b/src/website/federation/organizations/organization/UptimePage.java index 3f8df55..2f6db77 100644 --- a/src/website/federation/organizations/organization/UptimePage.java +++ b/src/website/federation/organizations/organization/UptimePage.java @@ -56,26 +56,31 @@ public class UptimePage extends HttpServlet { logger.info("PAGE Organization > Uptime"); - // Get parameters. - // =============== + 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(); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = UptimeView.htmlize(organization.getServices(), uptimes); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Disponibilité", "/federation/organizations/" + organization.getTechnicalName() + "/uptime.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Disponibilité", "/federation/organizations/" + organization.getTechnicalName() + "/uptime.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/metrics/MetricGenericPage.java b/src/website/federation/organizations/organization/metrics/MetricGenericPage.java index 603170f..1073efc 100644 --- a/src/website/federation/organizations/organization/metrics/MetricGenericPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricGenericPage.java @@ -66,29 +66,34 @@ public class MetricGenericPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Summary"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = htmlize(organization, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); - trail.add("Génériques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/generic.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); + trail.add("Génériques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/generic.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -116,7 +121,8 @@ public class MetricGenericPage extends HttpServlet * @throws IOException * Signals that an I/O exception has occurred. */ - public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosWebException, IOException + public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) + throws StatoolInfosWebException, IOException { String result; @@ -130,18 +136,23 @@ public class MetricGenericPage extends HttpServlet // data.setContent("graphic.users", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.users", ChartColor.GREEN)); - data.setContent("graphic.users.ipv4-ipv6", MetricHtmlizer.htmlize(organization, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW, - "metrics.service.users.ipv6", ChartColor.GREEN)); - data.setContent("graphic.users.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW)); + data.setContent("graphic.users.ipv4-ipv6", MetricHtmlizer.htmlize(organization, view, period, "service.users (ipv4 + ipv6)", + "metrics.service.users.ipv4", ChartColor.YELLOW, "metrics.service.users.ipv6", ChartColor.GREEN)); + data.setContent("graphic.users.ipv4", + MetricHtmlizer.htmlize(organization, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW)); data.setContent("graphic.users.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.users.ipv6", ChartColor.GREEN)); data.setContent("graphic.accounts", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.accounts", ChartColor.GREEN)); - data.setContent("graphic.accounts.active", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); - data.setContent("graphic.database.bytes", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); - data.setContent("graphic.datafiles.bytes", MetricHtmlizer.htmlize(organization, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); + data.setContent("graphic.accounts.active", + MetricHtmlizer.htmlize(organization, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); + data.setContent("graphic.database.bytes", + MetricHtmlizer.htmlize(organization, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); + data.setContent("graphic.datafiles.bytes", + MetricHtmlizer.htmlize(organization, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java b/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java index c5301cc..acda37a 100644 --- a/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricSpecificPage.java @@ -64,29 +64,34 @@ public class MetricSpecificPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Specific"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = htmlize(organization, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); - trail.add("Spécifiques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/specific.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); + trail.add("Spécifiques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/specific.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -113,7 +118,8 @@ public class MetricSpecificPage extends HttpServlet * @throws IOException * Signals that an I/O exception has occurred. */ - public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosWebException, IOException + public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) + throws StatoolInfosWebException, IOException { String result; @@ -127,7 +133,8 @@ public class MetricSpecificPage extends HttpServlet data.setContent("metricMenuView", MetricMenuView.htmlize(TypeMenu.SPECIFIC, view, period)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java b/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java index b717c3a..1e9b6df 100644 --- a/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricSummaryPage.java @@ -66,29 +66,34 @@ public class MetricSummaryPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Summary"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = htmlize(organization, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); - trail.add("Résumé", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/summary.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); + trail.add("Résumé", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/summary.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -116,7 +121,8 @@ public class MetricSummaryPage extends HttpServlet * @throws IOException * Signals that an I/O exception has occurred. */ - public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosWebException, IOException + public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) + throws StatoolInfosWebException, IOException { String result; @@ -131,7 +137,8 @@ public class MetricSummaryPage extends HttpServlet data.setContent("http.visits", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visits", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/organization/metrics/MetricWebPage.java b/src/website/federation/organizations/organization/metrics/MetricWebPage.java index 996f8fd..5f08d3c 100644 --- a/src/website/federation/organizations/organization/metrics/MetricWebPage.java +++ b/src/website/federation/organizations/organization/metrics/MetricWebPage.java @@ -65,29 +65,34 @@ public class MetricWebPage extends HttpServlet { logger.info("PAGE Organization > Metrics > Web"); - // Get parameters. - // =============== + 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(); - ViewMenu viewMenu = ViewMenu.valueFrom(request.getParameter("view")); - PeriodMenu periodMenu = PeriodMenu.valueFrom(request.getParameter("period")); + // 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); + // Send response. + // ============== + String headerView = OrganizationHeaderView.htmlize(organization, uptimes); + String contentView = htmlize(organization, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); - trail.add("Web", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/web.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/"); + trail.add("Web", "/federation/organizations/" + organization.getTechnicalName() + "/metrics/web.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -113,7 +118,8 @@ public class MetricWebPage extends HttpServlet * @throws IOException * Signals that an I/O exception has occurred. */ - public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosWebException, IOException + public static String htmlize(final Organization organization, final ViewMenu view, final PeriodMenu period) + throws StatoolInfosWebException, IOException { String result; @@ -127,20 +133,22 @@ public class MetricWebPage extends HttpServlet // data.setContent("http.hits", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits", ChartColor.BLUE)); - data.setContent("http.hits-ipv4ipv6", - MetricHtmlizer.htmlize(organization, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6", ChartColor.GREEN)); + data.setContent("http.hits-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.hits (ipv4 + ipv6)", + "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6", ChartColor.GREEN)); data.setContent("http.hits.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW)); data.setContent("http.hits.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN)); - data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN, - "metrics.http.hits.bots", ChartColor.YELLOW)); + data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.hits (humans + bots)", + "metrics.http.hits.humans", ChartColor.GREEN, "metrics.http.hits.bots", ChartColor.YELLOW)); data.setContent("http.hits.humans", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.humans", ChartColor.GREEN)); data.setContent("http.hits.bots", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.bots", ChartColor.YELLOW)); - data.setContent("http.hits.humans-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, - "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); - data.setContent("http.hits.humans.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); - data.setContent("http.hits.humans.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.hits.humans (ipv4 + ipv6)", + "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans.ipv4", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); + data.setContent("http.hits.humans.ipv6", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); data.setContent("http.errors", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.errors", ChartColor.RED)); data.setContent("http.errors.php", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.errors.php", ChartColor.RED)); @@ -151,42 +159,48 @@ public class MetricWebPage extends HttpServlet data.setContent("http.ip", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.ip", ChartColor.BLUE)); - data.setContent("http.ip-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN, - "metrics.http.ip.bots", ChartColor.YELLOW)); + data.setContent("http.ip-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.ip (humans + bots)", + "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots", ChartColor.YELLOW)); data.setContent("http.ip.humans", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.ip.humans", ChartColor.GREEN)); data.setContent("http.ip.bots", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.ip.bots", ChartColor.YELLOW)); - data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6", - ChartColor.GREEN)); + data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", + ChartColor.YELLOW, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.ip.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW)); data.setContent("http.ip.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.requesters", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters", ChartColor.BLUE)); - data.setContent("http.requesters-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, - "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters.humans", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); - data.setContent("http.requesters.bots", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW)); + data.setContent("http.requesters-humansbots", MetricHtmlizer.htmlize(organization, view, period, "http.requesters (humans + bots)", + "metrics.http.requesters.humans", ChartColor.GREEN, "metrics.http.requesters.bots", ChartColor.YELLOW)); + data.setContent("http.requesters.humans", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); + data.setContent("http.requesters.bots", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.requesters(ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, - "metrics.http.requesters.ipv6", ChartColor.GREEN)); - data.setContent("http.requesters.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW)); - data.setContent("http.requesters.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN)); + data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.requesters(ipv4 + ipv6)", + "metrics.http.requesters.ipv4", ChartColor.YELLOW, "metrics.http.requesters.ipv6", ChartColor.GREEN)); + data.setContent("http.requesters.ipv4", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW)); + data.setContent("http.requesters.ipv6", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN)); data.setContent("http.visitors", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visitors", ChartColor.BLUE)); - data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, - "metrics.http.visitors.ipv6", ChartColor.GREEN)); - data.setContent("http.visitors.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW)); + data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.visitors (ipv4 + ipv6)", + "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN)); + data.setContent("http.visitors.ipv4", + MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW)); data.setContent("http.visitors.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN)); data.setContent("http.visits", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visits", ChartColor.BLUE)); - data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, - "metrics.http.visits.ipv6", ChartColor.GREEN)); + data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(organization, view, period, "http.visits (ipv4 + ipv6)", + "metrics.http.visits.ipv4", ChartColor.YELLOW, "metrics.http.visits.ipv6", ChartColor.GREEN)); data.setContent("http.visits.ipv4", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW)); data.setContent("http.visits.ipv6", MetricHtmlizer.htmlize(organization, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/organization/services/IndexPage.java b/src/website/federation/organizations/organization/services/IndexPage.java index cb2fefd..1396f8d 100644 --- a/src/website/federation/organizations/organization/services/IndexPage.java +++ b/src/website/federation/organizations/organization/services/IndexPage.java @@ -34,7 +34,7 @@ import website.charter.ErrorView; /** * The Class IndexPage. */ -@KissServlet("^/federation/organizations/[^/]+/services/[^/]+/$") +@KissServlet("^/federation/organizations/[^/]+/services/$") public class IndexPage extends HttpServlet { private static final long serialVersionUID = -5951233202690068343L; diff --git a/src/website/federation/organizations/organization/services/service/CrawlPage.java b/src/website/federation/organizations/organization/services/service/CrawlPage.java index 813e5ea..dd865d8 100644 --- a/src/website/federation/organizations/organization/services/service/CrawlPage.java +++ b/src/website/federation/organizations/organization/services/service/CrawlPage.java @@ -57,29 +57,36 @@ public class CrawlPage extends HttpServlet { logger.info("PAGE Service > Crawl"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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()); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = CrawlView.htmlize(service.getCrawlJournal()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Journal", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/crawl.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Journal", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/crawl.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/services/service/IndexPage.java b/src/website/federation/organizations/organization/services/service/IndexPage.java index 41e2a00..b881587 100644 --- a/src/website/federation/organizations/organization/services/service/IndexPage.java +++ b/src/website/federation/organizations/organization/services/service/IndexPage.java @@ -21,6 +21,7 @@ package website.federation.organizations.organization.services.service; import java.io.IOException; import fr.devinsy.kiss4web.Redirector; +import fr.devinsy.kiss4web.dispatcher.annotation.KissServlet; import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.Service; import fr.devinsy.statoolinfosweb.StatoolInfosWeb; @@ -33,6 +34,7 @@ import website.charter.ErrorView; /** * The Class IndexPage. */ +@KissServlet("^/federation/organizations/[^/]+/services/[^/]+/$") public class IndexPage extends HttpServlet { private static final long serialVersionUID = -5951233202690068343L; @@ -58,7 +60,8 @@ public class IndexPage extends HttpServlet // Send response. // ============== - Redirector.redirect(response, "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/stats.xhtml"); + Redirector.redirect(response, + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/stats.xhtml"); } catch (Exception exception) { diff --git a/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java b/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java index e7df87a..b295fe0 100644 --- a/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java +++ b/src/website/federation/organizations/organization/services/service/PropertyAlertPage.java @@ -57,29 +57,36 @@ public class PropertyAlertPage extends HttpServlet { logger.info("PAGE Service > PropertyAlert"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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()); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = PropertyAlertView.htmlize(service.getInputChecksAll().getAlertLines()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Alertes", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/propertyAlert.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Alertes", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/propertyAlert.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java b/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java index 3105450..9ab754c 100644 --- a/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java +++ b/src/website/federation/organizations/organization/services/service/PropertyCheckPage.java @@ -57,29 +57,36 @@ public class PropertyCheckPage extends HttpServlet { logger.info("PAGE Service > PropertyCheck"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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()); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = PropertyCheckView.htmlize(service.getInputChecks()); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Propriétés", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/propertyCheck.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Propriétés", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/propertyCheck.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/services/service/ServiceHeaderView.java b/src/website/federation/organizations/organization/services/service/ServiceHeaderView.java index 3c24633..f5c28d3 100644 --- a/src/website/federation/organizations/organization/services/service/ServiceHeaderView.java +++ b/src/website/federation/organizations/organization/services/service/ServiceHeaderView.java @@ -58,8 +58,8 @@ public class ServiceHeaderView { TagDataManager data = new TagDataManager(); - data.setAttribute("serviceLogo", "src", - "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services/" + service.getTechnicalName() + "/" + service.getLogoFileName()); + data.setAttribute("serviceLogo", "src", "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services/" + + service.getTechnicalName() + "/" + service.getLogoFileName()); data.setEscapedContent("serviceName", service.getName()); if (service.getWebsiteURL() != null) @@ -84,16 +84,19 @@ public class ServiceHeaderView } data.setAttribute("serviceStatusImg", "src", "/commons/status-" + service.getStatus().toString().toLowerCase() + ".png"); - data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString())); + data.setAttribute("serviceStatusImg", "title", + StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString())); - data.setAttribute("organizationsLink", "href", "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services.xhtml"); + data.setAttribute("organizationsLink", "href", + "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services.xhtml"); data.setAttribute("servicesLink", "href", "services.xhtml"); data.setAttribute("rawLink", "href", service.getTechnicalName() + ".properties"); data.setAttribute("rawCheckLink", "href", "propertyCheck.xhtml"); data.setAttribute("statsLink", "href", "stats.xhtml"); - data.setAttribute("metricsLink", "href", "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); + data.setAttribute("metricsLink", "href", "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services/" + + service.getTechnicalName() + "/metrics/"); if (service.getLegalURL() != null) { @@ -186,7 +189,8 @@ public class ServiceHeaderView data.setAttribute("crawlLinkImg", "src", "/commons/circle-icons/download.svg"); } - data.setAttribute("uptimeLink", "href", "uptime.xhtml"); + data.setAttribute("uptimeLink", "href", "/federation/organizations/" + service.getOrganization().getTechnicalName() + "/services/" + + service.getTechnicalName() + "/uptime.xhtml"); Services services = new Services(); services.add(service); if (uptimeJournal.hasRecentError(services)) @@ -208,7 +212,8 @@ public class ServiceHeaderView } // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/serviceHeaderView.xhtml", data).toString(); + String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/serviceHeaderView.xhtml", data) + .toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/organizations/organization/services/service/ServicesPage.java b/src/website/federation/organizations/organization/services/service/ServicesPage.java index 357fb68..7a4ffd9 100644 --- a/src/website/federation/organizations/organization/services/service/ServicesPage.java +++ b/src/website/federation/organizations/organization/services/service/ServicesPage.java @@ -58,29 +58,36 @@ public class ServicesPage extends HttpServlet { logger.info("PAGE Service > Services"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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)); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = ServiceListView.htmlize(new Services(service)); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/services.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/services.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/services/service/StatsPage.java b/src/website/federation/organizations/organization/services/service/StatsPage.java index 7d098f9..0689a6a 100644 --- a/src/website/federation/organizations/organization/services/service/StatsPage.java +++ b/src/website/federation/organizations/organization/services/service/StatsPage.java @@ -65,29 +65,36 @@ public class StatsPage extends HttpServlet { logger.info("PAGE Service > Stats"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = htmlize(service); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Stats", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/stats.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Stats", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/stats.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); diff --git a/src/website/federation/organizations/organization/services/service/UptimePage.java b/src/website/federation/organizations/organization/services/service/UptimePage.java index 3057471..80ab84a 100644 --- a/src/website/federation/organizations/organization/services/service/UptimePage.java +++ b/src/website/federation/organizations/organization/services/service/UptimePage.java @@ -58,29 +58,36 @@ public class UptimePage extends HttpServlet { logger.info("PAGE Service > Uptime"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) + { + // Get parameters. + // =============== - // Use parameters. - // =============== - Service service = StatoolInfosWeb.instance().getServiceFromPathinfo(request.getPathInfo()); - Organization organization = service.getOrganization(); - UptimeJournal uptimeJournal = StatoolInfosWeb.instance().getUptimeJournal(); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = UptimeView.htmlize(new Services(service), uptimeJournal); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Disponibilité", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/uptime.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Disponibilité", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/uptime.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); 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 ceecb75..62e066b 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricGenericPage.java @@ -67,32 +67,40 @@ public class MetricGenericPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + 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")); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = htmlize(service, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); - trail.add("Générique", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/generic.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Métriques", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); + trail.add("Générique", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/metrics/generic.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -134,16 +142,19 @@ public class MetricGenericPage extends HttpServlet // data.setContent("graphic.users", MetricHtmlizer.htmlize(service, view, period, "metrics.service.users", ChartColor.GREEN)); - data.setContent("graphic.users.ipv4-ipv6", - MetricHtmlizer.htmlize(service, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW, "metrics.service.users.ipv6", ChartColor.GREEN)); + data.setContent("graphic.users.ipv4-ipv6", MetricHtmlizer.htmlize(service, view, period, "service.users (ipv4 + ipv6)", + "metrics.service.users.ipv4", ChartColor.YELLOW, "metrics.service.users.ipv6", ChartColor.GREEN)); data.setContent("graphic.users.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW)); data.setContent("graphic.users.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.service.users.ipv6", ChartColor.GREEN)); data.setContent("graphic.accounts", MetricHtmlizer.htmlize(service, view, period, "metrics.service.accounts", ChartColor.GREEN)); - data.setContent("graphic.accounts.active", MetricHtmlizer.htmlize(service, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); + data.setContent("graphic.accounts.active", + MetricHtmlizer.htmlize(service, view, period, "metrics.service.accounts.active", ChartColor.GREEN)); - data.setContent("graphic.database.bytes", MetricHtmlizer.htmlize(service, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); - data.setContent("graphic.datafiles.bytes", MetricHtmlizer.htmlize(service, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); + data.setContent("graphic.database.bytes", + MetricHtmlizer.htmlize(service, view, period, "metrics.service.database.bytes", ChartColor.GREEN)); + data.setContent("graphic.datafiles.bytes", + MetricHtmlizer.htmlize(service, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN)); // TODO // metrics.moderation.accounts.reported.* = @@ -153,7 +164,8 @@ public class MetricGenericPage extends HttpServlet // metrics.moderation.accounts.cancelled.* = // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricGenericView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) 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 363ec02..ecba0fc 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricSpecificPage.java @@ -67,32 +67,40 @@ public class MetricSpecificPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + 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")); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = htmlize(service, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); - trail.add("Spécifique", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/specific.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Métriques", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); + trail.add("Spécifique", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/metrics/specific.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -139,7 +147,8 @@ public class MetricSpecificPage extends HttpServlet } // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSpecificView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) 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 4be85f6..08e5fc1 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricSummaryPage.java @@ -67,32 +67,40 @@ public class MetricSummaryPage extends HttpServlet { logger.info("PAGE Service > MetricSummaryPage"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + 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")); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = htmlize(service, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); - trail.add("Résumé", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/summary.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Métriques", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); + trail.add("Résumé", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/metrics/summary.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -136,7 +144,8 @@ public class MetricSummaryPage extends HttpServlet data.setContent("http.visits", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visits", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricSummaryView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) 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 a0d7ec7..d3c36eb 100644 --- a/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java +++ b/src/website/federation/organizations/organization/services/service/metrics/MetricWebPage.java @@ -67,32 +67,40 @@ public class MetricWebPage extends HttpServlet { logger.info("PAGE Service > MetricGenericPage"); - // Get parameters. - // =============== + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + 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")); + // 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); + // Send response. + // ============== + String headerView = ServiceHeaderView.htmlize(service, uptimeJournal); + String contentView = htmlize(service, viewMenu, periodMenu); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Organisations", "/federation/organizations/"); - trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); - trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); - trail.add(service.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); - trail.add("Métriques", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); - trail.add("Web", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/web.xhtml"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Organisations", "/federation/organizations/"); + trail.add(organization.getName(), "/federation/organizations/" + organization.getTechnicalName() + "/"); + trail.add("Services", "/federation/organizations/" + organization.getTechnicalName() + "/services.xhtml"); + trail.add(service.getName(), + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/"); + trail.add("Métriques", + "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + "/metrics/"); + trail.add("Web", "/federation/organizations/" + organization.getTechnicalName() + "/services/" + service.getTechnicalName() + + "/metrics/web.xhtml"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -133,21 +141,22 @@ public class MetricWebPage extends HttpServlet data.setContent("http.hits", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits", ChartColor.BLUE)); - data.setContent("http.hits-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6", - ChartColor.GREEN)); + data.setContent("http.hits-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", + ChartColor.YELLOW, "metrics.http.hits.ipv6", ChartColor.GREEN)); data.setContent("http.hits.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW)); data.setContent("http.hits.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN)); - data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN, - "metrics.http.hits.bots", - ChartColor.YELLOW)); + data.setContent("http.hits-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.hits (humans + bots)", + "metrics.http.hits.humans", ChartColor.GREEN, "metrics.http.hits.bots", ChartColor.YELLOW)); data.setContent("http.hits.humans", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.humans", ChartColor.GREEN)); data.setContent("http.hits.bots", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.bots", ChartColor.YELLOW)); - data.setContent("http.hits.humans-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, - "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); - data.setContent("http.hits.humans.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); - data.setContent("http.hits.humans.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.hits.humans (ipv4 + ipv6)", + "metrics.http.hits.humans.ipv4", ChartColor.YELLOW, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); + data.setContent("http.hits.humans.ipv4", + MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW)); + data.setContent("http.hits.humans.ipv6", + MetricHtmlizer.htmlize(service, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN)); data.setContent("http.errors", MetricHtmlizer.htmlize(service, view, period, "metrics.http.errors", ChartColor.RED)); data.setContent("http.errors.php", MetricHtmlizer.htmlize(service, view, period, "metrics.http.errors.php", ChartColor.RED)); @@ -158,42 +167,44 @@ public class MetricWebPage extends HttpServlet data.setContent("http.ip", MetricHtmlizer.htmlize(service, view, period, "metrics.http.ip", ChartColor.BLUE)); - data.setContent("http.ip-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots", - ChartColor.YELLOW)); + data.setContent("http.ip-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", + ChartColor.GREEN, "metrics.http.ip.bots", ChartColor.YELLOW)); data.setContent("http.ip.humans", MetricHtmlizer.htmlize(service, view, period, "metrics.http.ip.humans", ChartColor.GREEN)); data.setContent("http.ip.bots", MetricHtmlizer.htmlize(service, view, period, "metrics.http.ip.bots", ChartColor.YELLOW)); - data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6", - ChartColor.GREEN)); + data.setContent("http.ip-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", + ChartColor.YELLOW, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.ip.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW)); data.setContent("http.ip.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN)); data.setContent("http.requesters", MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters", ChartColor.BLUE)); - data.setContent("http.requesters-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, - "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters.humans", MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); + data.setContent("http.requesters-humansbots", MetricHtmlizer.htmlize(service, view, period, "http.requesters (humans + bots)", + "metrics.http.requesters.humans", ChartColor.GREEN, "metrics.http.requesters.bots", ChartColor.YELLOW)); + data.setContent("http.requesters.humans", + MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters.humans", ChartColor.GREEN)); data.setContent("http.requesters.bots", MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW)); - data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, - "metrics.http.requesters.ipv6", ChartColor.GREEN)); + data.setContent("http.requesters-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.requesters (ipv4 + ipv6)", + "metrics.http.requesters.ipv4", ChartColor.YELLOW, "metrics.http.requesters.ipv6", ChartColor.GREEN)); data.setContent("http.requesters.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW)); data.setContent("http.requesters.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN)); data.setContent("http.visitors", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visitors", ChartColor.BLUE)); - data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, - "metrics.http.visitors.ipv6", ChartColor.GREEN)); + data.setContent("http.visitors-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.visitors (ipv4 + ipv6)", + "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN)); data.setContent("http.visitors.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW)); data.setContent("http.visitors.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN)); data.setContent("http.visits", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visits", ChartColor.BLUE)); - data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, - "metrics.http.visits.ipv6", ChartColor.GREEN)); + data.setContent("http.visits-ipv4ipv6", MetricHtmlizer.htmlize(service, view, period, "http.visits (ipv4 + ipv6)", + "metrics.http.visits.ipv4", ChartColor.YELLOW, "metrics.http.visits.ipv6", ChartColor.GREEN)); data.setContent("http.visits.ipv4", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW)); data.setContent("http.visits.ipv6", MetricHtmlizer.htmlize(service, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN)); // - String content = PresenterUtils.dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); + String content = PresenterUtils + .dynamize("/website/federation/organizations/organization/services/service/metrics/metricWebView.xhtml", data).toString(); result = XidynUtils.extractBodyContent(content); } catch (XidynException exception) diff --git a/src/website/federation/softwares/IndexPage.java b/src/website/federation/softwares/IndexPage.java index 1675469..a697822 100644 --- a/src/website/federation/softwares/IndexPage.java +++ b/src/website/federation/softwares/IndexPage.java @@ -66,27 +66,32 @@ public class IndexPage extends HttpServlet { logger.info("PAGE Federation > Softwares"); - // Get parameters. - // =============== + 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(); - Categories categories = StatoolInfosWeb.instance().getCategories(); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); + Categories categories = StatoolInfosWeb.instance().getCategories(); - // Send response. - // ============== - TagDataManager data = new TagDataManager(); + // Send response. + // ============== + TagDataManager data = new TagDataManager(); - String headerView = FederationHeaderView.htmlize(federation, uptimes); - String contentView = htmlize(StatAgent.statAllSoftwares(federation, categories)); + String headerView = FederationHeaderView.htmlize(federation, uptimes); + String contentView = htmlize(StatAgent.statAllSoftwares(federation, categories)); - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Logiciels", "/federation/softwares/"); + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Logiciels", "/federation/softwares/"); - String html = WebCharterView.build(headerView, contentView, trail); + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8"); @@ -123,12 +128,14 @@ public class IndexPage extends HttpServlet for (SoftwareStat stat : stats.sortByName()) { data.setEscapedContent("softwareListLine", index, "softwareListLineNameLink", stat.getName()); - data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", "/federation/softwares/" + stat.getTechnicalName() + ".xhtml"); + data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", + "/federation/softwares/" + stat.getTechnicalName() + ".xhtml"); data.setContent("softwareListLine", index, "softwareListLineCategory", CategoriesView.build(stat.getCategories(), Mode.ALL)); data.setContent("softwareListLine", index, "softwareListLineOrganizationCount", stat.getOrganizationCount()); - data.setContent("softwareListLine", index, "softwareListLineServiceCount", StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿")); + data.setContent("softwareListLine", index, "softwareListLineServiceCount", + StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿")); data.setContent("softwareListLine", index, "softwareListLineUserCount", StatoolInfosUtils.defaultIfZero(stat.getUserCount(), "😢")); data.setContent("softwareListLine", index, "softwareListLineVisitCount", StatoolInfosUtils.defaultIfZero(stat.getVisitCount(), "😞")); diff --git a/src/website/federation/softwares/SoftwarePage.java b/src/website/federation/softwares/SoftwarePage.java index 3c61d73..bb5f754 100644 --- a/src/website/federation/softwares/SoftwarePage.java +++ b/src/website/federation/softwares/SoftwarePage.java @@ -64,33 +64,38 @@ public class SoftwarePage extends HttpServlet { logger.info("PAGE Federation > Softwares > Software"); - // 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) + String html = StatoolInfosWeb.instance().getHtmlCache().get(this.getClass().getCanonicalName()); + if (html == null) { - throw new StatoolInfosWebException("Illegal software name."); - } - else - { - Services services = federation.getServices().getBy(software); - String contentView = htmlize(software, services); + // Get parameters. + // =============== - BreadcrumbTrail trail = new BreadcrumbTrail(); - trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); - trail.add("Logiciels", "/federation/softwares/"); + // Use parameters. + // =============== + Federation federation = StatoolInfosWeb.instance().getFederation(); + UptimeJournal uptimes = StatoolInfosWeb.instance().getUptimeJournal(); - String html = WebCharterView.build(headerView, contentView, trail); + // 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 + { + Services services = federation.getServices().getBy(software); + String contentView = htmlize(software, services); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(StatoolInfosWeb.instance().getFederation().getName(), "/federation/"); + trail.add("Logiciels", "/federation/softwares/"); + + html = WebCharterView.build(headerView, contentView, trail); + StatoolInfosWeb.instance().getHtmlCache().put(this.getClass().getCanonicalName(), html); + } // Display page. response.setContentType("application/xhtml+xml; charset=UTF-8");