diff --git a/src/wa/server/page/WALogPage.java b/src/wa/server/page/WALogPage.java
new file mode 100755
index 0000000..2851fe9
--- /dev/null
+++ b/src/wa/server/page/WALogPage.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015 ezivkoc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package wa.server.page;
+
+import zutil.net.http.HttpHeader;
+import zutil.net.http.HttpHeaderParser;
+import zutil.net.http.HttpPage;
+import zutil.net.http.HttpPrintStream;
+import zutil.parser.DataNode;
+import zutil.parser.json.JSONWriter;
+import zutil.struct.CircularBuffer;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+
+/**
+ * Created by Ziver on 2015-09-22.
+ */
+public class WALogPage extends Handler implements HttpPage {
+ private CircularBuffer logBuffer;
+
+ @Override
+ public void publish(LogRecord record) {
+ if(super.isLoggable(record)){
+ logBuffer.add(record);
+ }
+ }
+
+
+ @Override
+ public void flush() {}
+ @Override
+ public void close() throws SecurityException {
+ throw new UnsupportedOperationException ();
+ }
+
+
+ @Override
+ public void respond(HttpPrintStream out,
+ HttpHeader client_info,
+ Map session,
+ Map cookie,
+ Map request) throws IOException {
+
+ DataNode logNode = new DataNode(DataNode.DataType.List);
+ Iterator it = logBuffer.iterator();
+ for(int i=0; i<20 && it.hasNext(); ++i){
+ LogRecord record = it.next();
+ DataNode node = new DataNode(DataNode.DataType.Map);
+ node.set("timestamp", record.getMillis());
+ node.set("source", record.getLoggerName());
+ node.set("msg", record.getMessage());
+ logNode.add(node);
+ }
+
+ DataNode root = new DataNode(DataNode.DataType.Map);
+ root.add(logNode);
+ JSONWriter writer = new JSONWriter(out);
+ writer.write(root);
+ writer.close();
+ }
+}
diff --git a/src/wa/server/page/struct/WANavigation.java b/src/wa/server/page/struct/WANavigation.java
old mode 100644
new mode 100755
index b7f72df..86abcda
--- a/src/wa/server/page/struct/WANavigation.java
+++ b/src/wa/server/page/struct/WANavigation.java
@@ -80,6 +80,9 @@ public class WANavigation implements Iterable{
public String getName(){
return name;
}
+ public String getUrl(){
+ return url;
+ }
public Object getResource(){
return resource;
}
diff --git a/src/wa/server/plugin/apache/plugin.json b/src/wa/server/plugin/apache/plugin.json
old mode 100644
new mode 100755
index aec5df8..2ed2100
--- a/src/wa/server/plugin/apache/plugin.json
+++ b/src/wa/server/plugin/apache/plugin.json
@@ -1,8 +1,8 @@
{
"version": "1.0",
"name": "Apache Web Server",
- "interfaces": {
- "wa.server.plugin.WAService": "wa.server.plugin.apache.ApacheService",
- "wa.server.plugin.WAServiceStatus": "wa.server.plugin.apache.ApacheStatus"
- }
+ "interfaces": [
+ {"wa.server.plugin.WAService": "wa.server.plugin.apache.ApacheService"},
+ {"wa.server.plugin.WAServiceStatus": "wa.server.plugin.apache.ApacheStatus"}
+ ]
}
\ No newline at end of file
diff --git a/src/wa/server/plugin/hwstatus/HDDStatus.tmpl b/src/wa/server/plugin/hwstatus/HDDStatus.tmpl
old mode 100644
new mode 100755
index 7457803..0ebcb37
--- a/src/wa/server/plugin/hwstatus/HDDStatus.tmpl
+++ b/src/wa/server/plugin/hwstatus/HDDStatus.tmpl
@@ -8,30 +8,6 @@
-
-
-
HDD: {{.mount}} ({{.size_total}})
-
-
-
-
-
{{.size_free}}
-
-
-
-
Mount
-
Type
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
HDD: {{.mount}} ({{.size_total}})
+
+
+
+
+
{{.size_free}}
+
+
+
+
Mount
+
Type
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/wa/server/plugin/hwstatus/HwStatus.tmpl b/src/wa/server/plugin/hwstatus/HwStatus.tmpl
old mode 100644
new mode 100755
index c848361..4bb7a1c
--- a/src/wa/server/plugin/hwstatus/HwStatus.tmpl
+++ b/src/wa/server/plugin/hwstatus/HwStatus.tmpl
@@ -54,7 +54,7 @@ var cpu_data = {
};
function updateCpuChart(){
- $.getJSON("{{nav.url}}&json&cpu", function( data ) {
+ $.getJSON("{{nav.getUrl()}}&json&cpu", function( data ) {
// Setup graph
if(cpu_chart == null){
// Fill in cpus
@@ -102,7 +102,7 @@ var mem_data = [
];
function updateMemChart(){
- $.getJSON("{{nav.url}}&json&memory", function( data ) {
+ $.getJSON("{{nav.getUrl()}}&json&memory", function( data ) {
if(mem_chart == null){
var ctx = $("#mem-chart").get(0).getContext("2d");
mem_chart = new Chart(ctx).Doughnut(mem_data, {
@@ -123,7 +123,7 @@ function updateMemChart(){
function updateProcTable(){
- $.getJSON("{{nav.url}}&json&proc", function( data ) {
+ $.getJSON("{{nav.getUrl()}}&json&proc", function( data ) {
$('#proc-list').bootstrapTable({
data: data['proc']
});
diff --git a/src/wa/server/plugin/hwstatus/NetStatus.tmpl b/src/wa/server/plugin/hwstatus/NetStatus.tmpl
old mode 100644
new mode 100755
index 2ca781e..c4ed999
--- a/src/wa/server/plugin/hwstatus/NetStatus.tmpl
+++ b/src/wa/server/plugin/hwstatus/NetStatus.tmpl
@@ -73,7 +73,7 @@ var net_chart_data = {
};
function updateNet(){
- $.getJSON("{{nav.url}}&json&net", function( data ) {
+ $.getJSON("{{nav.getUrl()}}&json&net", function( data ) {
$.each(data['net'], function( index, net ){
var element = null;
var html_id = "net-" + net.id;
diff --git a/src/wa/server/plugin/tomcat/plugin.json b/src/wa/server/plugin/tomcat/plugin.json
old mode 100644
new mode 100755
index 7cb64cf..97ce091
--- a/src/wa/server/plugin/tomcat/plugin.json
+++ b/src/wa/server/plugin/tomcat/plugin.json
@@ -1,6 +1,6 @@
{
"version": "1.0",
- "name": "Apache Tomcat",
+ "name": "Tomcat",
"interfaces": {
"wa.server.plugin.WAService": "wa.server.plugin.apache.TomcatService",
"wa.server.plugin.WAServiceStatus": "wa.server.plugin.tomcat.TomcatStatus"