From: Fábio Madeira Date: Wed, 31 May 2017 16:01:22 +0000 (+0100) Subject: JWS-121 & JWS-111 Adding ‘timestamp’ (string formatted date + time) to the HttpServ... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=c204e33cf21d3d3899ef54cc741003a14f23b4b1;p=jabaws.git JWS-121 & JWS-111 Adding ‘timestamp’ (string formatted date + time) to the HttpServletRequest to be used in the jsp and setting ‘timexec’ as seconds instead of millisecs. --- 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}
  • --%>