incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Adding missing files.
Date Sun, 08 Mar 2015 19:59:48 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 047b62bc9 -> 33bb8b05b


Adding missing files.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/33bb8b05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/33bb8b05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/33bb8b05

Branch: refs/heads/master
Commit: 33bb8b05be216fb86403bae77f57ac09763657b4
Parents: 047b62b
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Mar 8 15:59:42 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Mar 8 15:59:42 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/blur/gui/LogServlet.java    | 58 +++++++++++++
 blur-status/src/main/resources/webapp/logs.html | 88 ++++++++++++++++++++
 2 files changed, 146 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33bb8b05/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
----------------------------------------------------------------------
diff --git a/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java b/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
new file mode 100644
index 0000000..e18f9d8
--- /dev/null
+++ b/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
@@ -0,0 +1,58 @@
+package org.apache.blur.gui;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+
+@SuppressWarnings("serial")
+public class LogServlet extends HttpServlet {
+
+  private final String _dir;
+
+  public LogServlet(String dir) {
+    _dir = dir;
+  }
+
+  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
+    String filename = request.getParameter("file");
+    response.setContentType("text/plain");
+    response.setHeader("Content-disposition", "attachment; filename=" + filename);
+    if (filename.contains("/")) {
+      throw new IOException("Filename [" + filename + "] with '/' is not allowed.");
+    }
+    File file = new File(new File(_dir), filename);
+    if (!file.exists()) {
+      throw new IOException("Filename [" + filename + "] doe snot exist.");
+    }
+    FileInputStream input = new FileInputStream(file);
+    ServletOutputStream outputStream = response.getOutputStream();
+    IOUtils.copy(input, outputStream);
+    input.close();
+    outputStream.flush();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33bb8b05/blur-status/src/main/resources/webapp/logs.html
----------------------------------------------------------------------
diff --git a/blur-status/src/main/resources/webapp/logs.html b/blur-status/src/main/resources/webapp/logs.html
new file mode 100644
index 0000000..d842c6c
--- /dev/null
+++ b/blur-status/src/main/resources/webapp/logs.html
@@ -0,0 +1,88 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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.
+-->
+<html>
+<head>
+<title>Blur - Logs</title>
+<meta charset="utf-8">
+<link href="css/bootstrap.min.css" rel="stylesheet">
+<link href="css/bs-docs.css" rel="stylesheet" media="screen">
+</head>
+
+<script src="js/jquery-1.9.1.min.js"></script>
+<script src="js/thrift.js"></script>
+<script src="js/Blur.js"></script>
+<script src="js/Blur_types.js"></script>
+<script>
+function displayPage() {
+  var fetchRequest = $.ajax({
+    type: "GET",
+    url: "/logs"
+  });
+
+  fetchRequest.done(function(msg) {
+    var logfiles = jQuery.parseJSON(msg);
+    var body = $("#page_body");
+    var files = logfiles.files;
+    for (var i = 0; i < files.length; i++) {
+	  var filename = files[i];
+      body.append("<a href=\"/log?file="+filename+"\">"+filename+"</a><br/>");
+    }
+  });
+
+  fetchRequest.fail(function(jqXHR, textStatus) {
+    alert(textStatus);
+  });	
+	
+/*    try {
+	  var body = $("#page_body");
+      body.append("<h2>Log Output</h2>");
+    } catch(ouch){
+alert (ouch);
+    }*/
+}
+$(window).bind("load", displayPage);
+</script>
+<body>
+	<div class="navbar navbar-inverse navbar-fixed-top">
+    <div class="container">
+      <div class="navbar-header">
+        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </button>
+        <a class="navbar-brand" href="http://incubator.apache.org/blur">Apache Blur
(Incubator)</a>
+      </div>
+      <div class="collapse navbar-collapse">
+        <ul class="nav navbar-nav">
+          <li class="active"><a href="index.html">Home</a></li>
+          <li><a href="config.html">Configuration</a></li>
+          <li><a href="metrics.html">Metrics</a></li>
+          <li><a href="traces.html">Traces</a></li>
+        </ul>
+      </div>
+    </div>
+  </div>
+  <table class="table-bordered table-condensed">
+  	<tbody>
+  		<tr><td id="page_body"></td></tr>
+  	</tbody>
+  </table>
+</body>
+</html>


Mime
View raw message