JWS-121 & JWS-109 Improved the way the service_status.jsp and usage_statistics.jsp...
authorFábio Madeira <fmmarquesmadeira@dundee.ac.uk>
Wed, 31 May 2017 16:37:23 +0000 (17:37 +0100)
committerFábio Madeira <fmmarquesmadeira@dundee.ac.uk>
Wed, 31 May 2017 16:37:23 +0000 (17:37 +0100)
website/refresh_service_status.sh [new file with mode: 0644]
website/service_status.jsp
website/statpages/MonthlySummary.jsp
website/statpages/ServicesStatus.jsp
website/usage_statistics.jsp

diff --git a/website/refresh_service_status.sh b/website/refresh_service_status.sh
new file mode 100644 (file)
index 0000000..4d730bb
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# run command as ./refresh_service_status.sh http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/ServiceStatus 15 cached_service_status.html &
+# the command starts executing, but continues to run forever
+
+# Host URL $1 (example: http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/ServiceStatus)
+# Host URL $1 (example: http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/PublicAnnualStat)
+if [ -z "$1" ]
+  then
+    echo "Hostname needs to be passed as 1st argument! (example http://compbio.lifesci.dundee.ac.uk/jabaws/ServiceStatus)"
+    exit 1
+fi
+
+# Refresh Time $2 (minutes)
+if [ -z "$2" ]
+  then
+    echo "Refresh Time (min) needs to be passed as 2nd argument! (example 15)"
+    exit 1
+fi
+
+# Output-file $3 (html) (example: cached_service_status.html)
+# Output-file $3 (html) (example: cached_usage_statistics.html)
+if [ -z "$3" ]
+  then
+    echo "Outputfile (html) needs to be passed as 3rd argument! (example: cached_service_status.html)"
+    exit 1
+fi
+
+# gets the file as a tmp
+while :; do echo "Fetching from $1:" `date "+%d/%m/%Y %H:%M:%S"`; wget -q $1 -O "tmp_cache.html"; mv "tmp_cache.html" $3; sleep $2m; done
index 892c78d..94873d9 100644 (file)
@@ -6,52 +6,6 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
 
-<c:import url="/template_header.jsp" >
-       <c:param name="title">Service Status</c:param>
-       <c:param name="html_custom_css"><link href="${pageContext.request.contextPath}/static/css/table.css"
-                                                                                 rel="stylesheet"></c:param>
-</c:import>
-
-<%-- check if the cached page is available: if not redirects--%>
-<%@ page import="java.io.*,java.net.*" %>
-<%
-    URL url = new URL(request.getRequestURL().toString().replaceAll("/service_status.jsp", "") +
-                      "/cached_service_status.html");
-    HttpURLConnection http = (HttpURLConnection)url.openConnection();
-    int statusCode = http.getResponseCode();
-    if (statusCode != 200) {
-        String redirectURL = "ServiceStatus";
-        response.sendRedirect(redirectURL);}
-%>
-
-<%-- load cached Service Status --%>
-    <div class="row">
-        <div class="col-md-3"></div>
-        <div class="col-md-6">
-            <div class="center-block">
-                <hidden_loader style="display:none;">
-                    <div class="alert alert-warning" role="alert">
-                        <p style="text-align: center; font-size: 16px">
-                            <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
-                            &nbsp;&nbsp;&nbsp;&nbsp;This request usually takes several minutes to be served...
-                        </p>
-                    </div>
-                </hidden_loader>
-            </div>
-        </div>
-        <div class="col-md-3"></div>
-    </div>
-
-<div class="row" id="mainpage">
-       <div class="col-md-12">
-        <p>The results shown below have been cached from a request made (up to an hour) before...
-        <a class="btn btn-default" href="${pageContext.request.contextPath}/ServiceStatus" role="button"
-        title="JABAWS web-services status."
-           id="show_hidden1"><i class="fa fa-cogs" aria-hidden="true"></i> Get fresh Service Status</a>
-        </p>
-    </div>
-</div>
 
+<%@ page errorPage="ServiceStatus" %>
 <jsp:include page="/cached_service_status.html" />
-
-<jsp:include page="/template_footer.jsp" />
index 382642d..a6cac63 100644 (file)
@@ -13,6 +13,24 @@ Date: May 2011
                                                                                  rel="stylesheet"></c:param>
 </c:import>
 
+<%-- load cached Service Status --%>
+    <div class="row">
+        <div class="col-md-3"></div>
+        <div class="col-md-6">
+            <div class="center-block">
+                <hidden_loader style="display:none;">
+                    <div class="alert alert-warning" role="alert">
+                        <p style="text-align: center; font-size: 16px">
+                            <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
+                            &nbsp;&nbsp;&nbsp;&nbsp;This request usually takes several minutes to be served...
+                        </p>
+                    </div>
+                </hidden_loader>
+            </div>
+        </div>
+        <div class="col-md-3"></div>
+    </div>
+
 <div class="row" id="mainpage">
        <div class="col-md-12">
                <div class="panel panel-default">
index 7c0fa76..97735f8 100644 (file)
@@ -17,6 +17,24 @@ TODO refactor
                                                                                  rel="stylesheet"></c:param>
 </c:import>
 
+<%-- load cached Service Status --%>
+    <div class="row">
+        <div class="col-md-3"></div>
+        <div class="col-md-6">
+            <div class="center-block">
+                <hidden_loader style="display:none;">
+                    <div class="alert alert-warning" role="alert">
+                        <p style="text-align: center; font-size: 16px">
+                            <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
+                            &nbsp;&nbsp;&nbsp;&nbsp;This request usually takes several minutes to be served...
+                        </p>
+                    </div>
+                </hidden_loader>
+            </div>
+        </div>
+        <div class="col-md-3"></div>
+    </div>
+
 <div class="row" id="mainpage">
        <div class="col-md-12">
                <div class="panel panel-default">
index 5f0f6b3..5171b3c 100644 (file)
@@ -6,52 +6,6 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
 
-<c:import url="/template_header.jsp" >
-       <c:param name="title">Usage Statistics</c:param>
-       <c:param name="html_custom_css"><link href="${pageContext.request.contextPath}/static/css/table.css"
-                                                                                 rel="stylesheet"></c:param>
-</c:import>
-
-<%-- check if the cached page is available: if not redirects--%>
-<%@ page import="java.io.*,java.net.*" %>
-<%
-    URL url = new URL(request.getRequestURL().toString().replaceAll("/usage_statistics.jsp", "") +
-                      "/cached_usage_statistics.html");
-    HttpURLConnection http = (HttpURLConnection)url.openConnection();
-    int statusCode = http.getResponseCode();
-    if (statusCode != 200) {
-        String redirectURL = "PublicAnnualStat";
-        response.sendRedirect(redirectURL);}
-%>
-
-<%-- load cached Service Status --%>
-    <div class="row">
-        <div class="col-md-3"></div>
-        <div class="col-md-6">
-            <div class="center-block">
-                <hidden_loader style="display:none;">
-                    <div class="alert alert-warning" role="alert">
-                        <p style="text-align: center; font-size: 16px">
-                            <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
-                            &nbsp;&nbsp;&nbsp;&nbsp;This request usually takes several minutes to be served...
-                        </p>
-                    </div>
-                </hidden_loader>
-            </div>
-        </div>
-        <div class="col-md-3"></div>
-    </div>
-
-<div class="row" id="mainpage">
-       <div class="col-md-12">
-        <p>The results shown below have been cached from a request made (up to an hour) before...
-        <a class="btn btn-default" href="${pageContext.request.contextPath}/PublicAnnualStat" role="button"
-        title="JABAWS server usage statistics."
-           id="show_hidden2"><i class="fa fa-bar-chart" aria-hidden="true"></i> Get fresh Usage Statistics</a>
-        </p>
-    </div>
-</div>
 
+<%@ page errorPage="PublicAnnualStat" %>
 <jsp:include page="/cached_usage_statistics.html" />
-
-<jsp:include page="/template_footer.jsp" />