JWS-121 Added new jsp enpoints that try loading chached service status and usage...
authorFábio Madeira <fmmarquesmadeira@dundee.ac.uk>
Mon, 29 May 2017 16:42:37 +0000 (17:42 +0100)
committerFábio Madeira <fmmarquesmadeira@dundee.ac.uk>
Mon, 29 May 2017 16:47:37 +0000 (17:47 +0100)
website/service_status.jsp [new file with mode: 0644]
website/template_footer.jsp
website/template_header.jsp
website/usage_statistics.jsp [new file with mode: 0644]

diff --git a/website/service_status.jsp b/website/service_status.jsp
new file mode 100644 (file)
index 0000000..892c78d
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ 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>
+
+<jsp:include page="/cached_service_status.html" />
+
+<jsp:include page="/template_footer.jsp" />
index d89ea8f..d5c2d57 100644 (file)
                         <a href="${pageContext.request.contextPath}/about.jsp#citing">Citing JABAWS</a>
                     </li>
                     <li>
-                        <a href="${pageContext.request.contextPath}/ServiceStatus" title="JABAWS webservices status. Click to test all web services.
-                        Please be patient while the services are being checked" id="show_hidden3">Service Status</a>
+                        <a href="${pageContext.request.contextPath}/service_status.jsp" >Service Status</a>
                     </li>
 
                     <li>
-                        <a href="${pageContext.request.contextPath}/PublicAnnualStat" title="JABAWS server usage statistics"
-                           id="show_hidden4">Usage Statistics</a>
+                        <a href="${pageContext.request.contextPath}/usage_statistics.jsp" >Usage Statistics</a>
                     </li>
                     <li>
                         <a href="${pageContext.request.contextPath}/about.jsp#funding">Funding</a>
index 4309962..fff4c81 100644 (file)
                     </ul>
                 </li>
                 <li>
-                    <a href="${pageContext.request.contextPath}/ServiceStatus"
-                       title="JABAWS webservices status. Click to test all web services. Please be patient while the services are being checked"
-                       id="show_hidden1">
+                    <a href="${pageContext.request.contextPath}/service_status.jsp" >
                         <i class="fa fa-cogs" aria-hidden="true"></i> Service Status</a>
                 </li>
                 <li>
-                    <a href="${pageContext.request.contextPath}/PublicAnnualStat" title="JABAWS server usage statistics" id="show_hidden2">
+                    <a href="${pageContext.request.contextPath}/usage_statistics.jsp" >
                         <i class="fa fa-bar-chart" aria-hidden="true"></i> Usage Statistics</a>
                 </li>
                 <!--Includes funding and contacts (v2.2)-->
 
 <!--body -->
 <div class="container">
-    <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>
diff --git a/website/usage_statistics.jsp b/website/usage_statistics.jsp
new file mode 100644 (file)
index 0000000..5f0f6b3
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ 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>
+
+<jsp:include page="/cached_usage_statistics.html" />
+
+<jsp:include page="/template_footer.jsp" />