Skip to content

Commit

Permalink
Fixes RootITest and adds the status page.
Browse files Browse the repository at this point in the history
Resources can't go in a 'static' folder because JBossWeb doesn't have something similar to 'resolve-against-context-root' in Undertow.
  • Loading branch information
tsegismont authored and Stefan Negrea committed Aug 13, 2015
1 parent de97ae3 commit c8e3641
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 6 deletions.
20 changes: 19 additions & 1 deletion api/metrics-api-jaxrs-1.1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@
</server-args>
</configuration>
</plugin>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
Expand All @@ -160,6 +160,24 @@
<!-- <manifestEntries> <Build-Number>${buildNumber}</Build-Number>
</manifestEntries> -->
</archive>
<webResources>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/webapp</directory>
<excludes>
<exclude>WEB-INF/web.xml</exclude>
<exclude>static/index.html</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
<include>static/index.html</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>

Expand Down
18 changes: 13 additions & 5 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@
<param-value>org.hawkular.metrics.api.jaxrs.util.JacksonContextResolver</param-value>
</context-param>

<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>true</param-value>
</context-param>

<servlet>
<servlet-name>staticContent</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>staticContent</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
</web-app>
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
~ Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Hawkular Metrics</title>
<link rel="shortcut icon" href="/hawkular/metrics/static/favicon.ico" type="image/x-icon">
<link rel="StyleSheet" href="/hawkular/metrics/static/welcome.css" type="text/css">
<script src="/hawkular/metrics/static/status.js"></script>
</head>

<body>
<div class="content">
<div class="logo"/>
<img src="/hawkular/metrics/static/hawkular_logo.png" alt="Hawkular Logo"/>
</div>
<h1>Hawkular Metrics</h1>

<h3>A time series metrics engine based on Cassandra</h3>

<p>${project.version}</p>

<p id="status">Status: <i>Checking...</i></p>
</div>
</body>
</html>
45 changes: 45 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var httpRequest;

if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
}

httpRequest.onreadystatechange = updateStatus;
httpRequest.open("GET", "/hawkular/metrics/status");
httpRequest.send();

function updateStatus() {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
statusJson = JSON.parse(httpRequest.responseText);
document.getElementById("status").innerHTML = "Metrics Service :" + statusJson.MetricsService;
} else if (httpRequest.status === 404 || httpRequest.status === 503) {
document.getElementById("status").innerHTML = "The server is not available";
} else {
document.getElementById("status").innerHTML = "An error occured while accessing the server :" + httpRequest.responseText;
}
}
}
50 changes: 50 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/welcome.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@import url(http://fonts.googleapis.com/css?family=Exo+2);

html {
width: 100%;
}

body {
font-family: 'Exo 2', sans-serif;
}

.content {
margin-left: auto;
margin-right: auto;
max-width: 100%;
width: 50em padding : 1 em;
text-align: center;
}

.logo {
margin-left: auto;
margin-right: auto;
text-align: center;
}

.logo img {
max-width: 100%;
margin-left: auto;
margin-right: auto;
}

h1, h3 {
text-align: center;
word-wrap: break-word;
}

0 comments on commit c8e3641

Please sign in to comment.