From c204e33cf21d3d3899ef54cc741003a14f23b4b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?F=C3=A1bio=20Madeira?= Date: Wed, 31 May 2017 17:01:22 +0100 Subject: [PATCH] =?utf8?q?JWS-121=20&=20JWS-111=20Adding=20=E2=80=98timestam?= =?utf8?q?p=E2=80=99=20=20(string=20formatted=20date=20+=20time)=20=20to=20t?= =?utf8?q?he=20HttpServletRequest=20to=20be=20used=20in=20the=20jsp=20and=20?= =?utf8?q?setting=20=E2=80=98timexec=E2=80=99=20as=20seconds=20instead=20of=20?= =?utf8?q?millisecs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- webservices/compbio/stat/servlet/AnnualStat.java | 8 +++++++- webservices/compbio/stat/servlet/ServiceStatus.java | 9 +++++++-- website/statpages/MonthlySummary.jsp | 7 +++++-- website/statpages/ServicesStatus.jsp | 13 ++++++++----- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/webservices/compbio/stat/servlet/AnnualStat.java b/webservices/compbio/stat/servlet/AnnualStat.java index 26150de..eead7a5 100644 --- a/webservices/compbio/stat/servlet/AnnualStat.java +++ b/webservices/compbio/stat/servlet/AnnualStat.java @@ -22,6 +22,8 @@ import java.io.PrintWriter; import java.sql.SQLException; import java.util.Date; import java.util.Map; +import java.util.Calendar; +import java.text.SimpleDateFormat; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; @@ -55,7 +57,11 @@ public class AnnualStat extends HttpServlet { long endTime = System.nanoTime(); req.setAttribute("stat", monthlyTotals); req.setAttribute("total", Totals.sumOfTotals(monthlyTotals)); - req.setAttribute("timeexec", (endTime - startTime) / 1000000); +// req.setAttribute("timeexec", (endTime - startTime) / 1000000); + req.setAttribute("timeexec", (endTime - startTime) / 100000000); + String timeStamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format( + Calendar.getInstance().getTime()); + req.setAttribute("timestamp", timeStamp); RequestDispatcher dispatcher = req.getRequestDispatcher("statpages/MonthlySummary.jsp"); diff --git a/webservices/compbio/stat/servlet/ServiceStatus.java b/webservices/compbio/stat/servlet/ServiceStatus.java index 93df9f5..0b82be9 100644 --- a/webservices/compbio/stat/servlet/ServiceStatus.java +++ b/webservices/compbio/stat/servlet/ServiceStatus.java @@ -29,7 +29,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.Collections; +import java.util.Calendar; +import java.text.SimpleDateFormat; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; @@ -148,7 +149,11 @@ public class ServiceStatus extends HttpServlet { } req.setAttribute("results", testResults); long endTime = System.nanoTime(); - req.setAttribute("timeexec", (endTime - startTime) / 1000000); +// req.setAttribute("timeexec", (endTime - startTime) / 1000000); + req.setAttribute("timeexec", (endTime - startTime) / 100000000); + String timeStamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format( + Calendar.getInstance().getTime()); + req.setAttribute("timestamp", timeStamp); RequestDispatcher rd = req.getRequestDispatcher("statpages/ServicesStatus.jsp"); rd.forward(req, resp); } diff --git a/website/statpages/MonthlySummary.jsp b/website/statpages/MonthlySummary.jsp index a1f0090..382642d 100644 --- a/website/statpages/MonthlySummary.jsp +++ b/website/statpages/MonthlySummary.jsp @@ -22,10 +22,13 @@ Date: May 2011

diff --git a/website/statpages/ServicesStatus.jsp b/website/statpages/ServicesStatus.jsp index 27b622e..7c0fa76 100644 --- a/website/statpages/ServicesStatus.jsp +++ b/website/statpages/ServicesStatus.jsp @@ -34,12 +34,15 @@ TODO refactor This servlet tests if the web services are healthy on the tomcat instance on which JABAWS is deployed.
If the tomcat instance is mapped to another "proxy" web server, the servlet does not test availability of
the web services at the endpoints of this external web server. -
  • All the web services are tested while this page is being loaded.
  • -
  • If you want to test the services again, reload this page.
  • + <%--
  • All the web services are tested while this page is being loaded.
  • --%> + <%--
  • If you want to test the services again, reload this page.
  • --%>
  • Click on the service status to see the results of the testing.
  • -
  • Server tested: ${host}
  • -
  • Time of execusion: ${timeexec} msec
  • -
  • Your IP is ${pageContext.request.remoteAddr}
  • +
  • Server: ${host}
  • +
  • Time of execution: ${timeexec} sec
  • +
  • Service Status as of: ${timestamp}
  • +
  • Refresh Service Status
  • + <%--
  • Your IP is ${pageContext.request.remoteAddr}
  • --%>

    -- 1.7.10.2