Updated Branches:
  refs/heads/master 9cd32ca4f -> d0d535c7d

Web app cleanup.


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

Branch: refs/heads/master
Commit: d0d535c7df66ee1071ff62e23ffe78214f56feff
Parents: e9ff8c4
Author: Aaron McCurry <[email protected]>
Authored: Sat Sep 1 19:45:19 2012 -0400
Committer: Aaron McCurry <[email protected]>
Committed: Sat Sep 1 19:45:19 2012 -0400

----------------------------------------------------------------------
 bin/blur-config.sh                                 |    4 +
 src/blur-core/pom.xml                              |    7 +
 .../blur/thrift/ThriftBlurControllerServer.java    |    5 +-
 src/blur-gui/pom.xml                               |   96 +-
 .../com/nearinfinity/blur/gui/HttpJettyServer.java |  180 +-
 .../java/com/nearinfinity/blur/gui/LogServlet.java |  129 +-
 .../com/nearinfinity/blur/gui/MetricsServlet.java  |   29 +-
 src/blur-gui/src/main/webapp/WEB-INF/web.xml       |    8 +
 src/blur-gui/src/main/webapp/d3.v2.js              | 9406 +++++++++++++++
 src/blur-gui/src/main/webapp/d3.v2.min.js          |    4 +
 src/blur-gui/src/main/webapp/footer.jsp            |    2 +
 src/blur-gui/src/main/webapp/functions.jsp         |   25 +
 src/blur-gui/src/main/webapp/home.jsp              |  120 +
 src/blur-gui/src/main/webapp/index.html            |   13 +
 src/blur-gui/src/main/webapp/metrics.jsp           |  120 +
 src/blur-gui/src/main/webapp/shardList.jsp         |   60 +
 src/blur-gui/src/main/webapp/style.css             |   53 +
 src/blur-gui/src/main/webapp/table.jsp             |  153 +
 src/blur-gui/src/main/webapp/test.html             |  123 +
 .../src/main/webapps/controller/WEB-INF/web.xml    |    8 -
 src/blur-gui/src/main/webapps/controller/d3.v2.js  | 9406 ---------------
 .../src/main/webapps/controller/d3.v2.min.js       |    4 -
 .../src/main/webapps/controller/footer.jsp         |    2 -
 .../src/main/webapps/controller/functions.jsp      |   25 -
 src/blur-gui/src/main/webapps/controller/home.jsp  |  120 -
 .../src/main/webapps/controller/index.html         |   13 -
 .../src/main/webapps/controller/metrics.jsp        |  120 -
 .../src/main/webapps/controller/shardList.jsp      |   60 -
 src/blur-gui/src/main/webapps/controller/style.css |   53 -
 src/blur-gui/src/main/webapps/controller/table.jsp |  153 -
 src/blur-gui/src/main/webapps/controller/test.html |  123 -
 31 files changed, 10344 insertions(+), 10280 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/bin/blur-config.sh
----------------------------------------------------------------------
diff --git a/bin/blur-config.sh b/bin/blur-config.sh
index 664d1f3..400f1f6 100755
--- a/bin/blur-config.sh
+++ b/bin/blur-config.sh
@@ -77,6 +77,10 @@ for f in $BLUR_HOME/lib/*.jar; do
   BLUR_CLASSPATH=${BLUR_CLASSPATH}:$f;
 done
 
+for f in $BLUR_HOME/lib/*.war; do
+  BLUR_CLASSPATH=${BLUR_CLASSPATH}:$f;
+done
+
 for f in $HADOOP_HOME/lib/jsp-2.1/*.jar; do
  BLUR_CLASSPATH=${BLUR_CLASSPATH}:$f;
 done

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-core/pom.xml
----------------------------------------------------------------------
diff --git a/src/blur-core/pom.xml b/src/blur-core/pom.xml
index 414d140..a32272e 100644
--- a/src/blur-core/pom.xml
+++ b/src/blur-core/pom.xml
@@ -35,6 +35,13 @@
                        <groupId>com.nearinfinity.blur</groupId>
                        <artifactId>blur-gui</artifactId>
                        <version>0.1.3</version>
+                       <type>jar</type>
+               </dependency>
+               <dependency>
+                       <groupId>com.nearinfinity.blur</groupId>
+                       <artifactId>blur-gui</artifactId>
+                       <version>0.1.3</version>
+                       <type>war</type>
                </dependency>
                <dependency>
                        <groupId>org.apache.zookeeper</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git 
a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java
 
b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java
index 8b9b0be..45ad653 100644
--- 
a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java
+++ 
b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java
@@ -33,11 +33,11 @@ import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MA
 import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MUTATE_DELAY;
 import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_CONTROLLER_SERVER_REMOTE_THREAD_COUNT;
 import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT;
-import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION;
-import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE;
 import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_GUI_CONTROLLER_PORT;
 import static com.nearinfinity.blur.utils.BlurConstants.BLUR_GUI_SHARD_PORT;
 import static com.nearinfinity.blur.utils.BlurConstants.BLUR_SHARD_BIND_PORT;
+import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION;
+import static 
com.nearinfinity.blur.utils.BlurConstants.BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE;
 import static com.nearinfinity.blur.utils.BlurUtil.quietClose;
 
 import java.util.concurrent.TimeUnit;
@@ -136,7 +136,6 @@ public class ThriftBlurControllerServer extends 
ThriftServer {
     final HttpJettyServer httpServer;
     if (baseGuiPort > 0) {
       int webServerPort = baseGuiPort + serverIndex;
-
       // TODO: this got ugly, there has to be a better way to handle all these
       // params
       // without reversing the mvn dependancy and making blur-gui on top.

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-gui/pom.xml
----------------------------------------------------------------------
diff --git a/src/blur-gui/pom.xml b/src/blur-gui/pom.xml
index 3ea45f2..a5c9904 100644
--- a/src/blur-gui/pom.xml
+++ b/src/blur-gui/pom.xml
@@ -8,7 +8,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.nearinfinity.blur</groupId>
        <artifactId>blur-gui</artifactId>
-       <packaging>jar</packaging>
+       <packaging>war</packaging>
        <name>Blur GUI</name>
 
        <properties>
@@ -65,41 +65,65 @@
        </repositories>
 
        <build>
-       <pluginManagement>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <configuration>
-                                       <source>1.6</source>
-                                       <target>1.6</target>
-                               </configuration>
-                       </plugin>
-
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-dependency-plugin</artifactId>
-                               <executions>
-                                       <execution>
-                                               <id>copy-dependencies</id>
-                                               <phase>package</phase>
-                                               <goals>
-                                                       
<goal>copy-dependencies</goal>
-                                               </goals>
-                                               <configuration>
-                                                       
<outputDirectory>${project.build.directory}/../../../lib
-                                                       </outputDirectory>
-                                                       
<overWriteReleases>false</overWriteReleases>
-                                                       
<overWriteSnapshots>false</overWriteSnapshots>
-                                                       
<overWriteIfNewer>true</overWriteIfNewer>
-                                                       
<excludeTransitive>true</excludeTransitive>
-                                                       
<excludeArtifactIds>junit,commons-cli,commons-logging,hadoop-core,slf4j-api
-                                                       </excludeArtifactIds>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
-               </plugins>
+               <pluginManagement>
+                       <plugins>
+                               <plugin>
+                                       
<artifactId>maven-war-plugin</artifactId>
+                                       <configuration>
+                                               
<archiveClasses>true</archiveClasses>
+                                       </configuration>
+                               </plugin>
+                               <plugin>
+                                       
<groupId>org.apache.maven.plugins</groupId>
+                                       
<artifactId>maven-compiler-plugin</artifactId>
+                                       <configuration>
+                                               <source>1.6</source>
+                                               <target>1.6</target>
+                                       </configuration>
+                               </plugin>
+                               <plugin>
+                                       
<groupId>org.apache.maven.plugins</groupId>
+                                       
<artifactId>maven-dependency-plugin</artifactId>
+                                       <executions>
+                                               <execution>
+                                                       
<id>copy-dependencies</id>
+                                                       <phase>package</phase>
+                                                       <goals>
+                                                               
<goal>copy-dependencies</goal>
+                                                       </goals>
+                                                       <configuration>
+                                                               
<outputDirectory>${project.build.directory}/../../../lib</outputDirectory>
+                                                               
<overWriteReleases>false</overWriteReleases>
+                                                               
<overWriteSnapshots>false</overWriteSnapshots>
+                                                               
<overWriteIfNewer>true</overWriteIfNewer>
+                                                               
<excludeTransitive>true</excludeTransitive>
+                                                               
<excludeArtifactIds>junit,commons-cli,commons-logging,hadoop-core,slf4j-api</excludeArtifactIds>
+                                                       </configuration>
+                                               </execution>
+                                       </executions>
+                               </plugin>
+                               <plugin>
+                                       
<groupId>org.apache.maven.plugins</groupId>
+                                       
<artifactId>maven-install-plugin</artifactId>
+                                       <executions>
+                                               <execution>
+                                                       <phase>install</phase>
+                                                       <goals>
+                                                               
<goal>install-file</goal>
+                                                       </goals>
+                                                       <configuration>
+                                                               
<packaging>jar</packaging>
+                                                               
<artifactId>${project.artifactId}</artifactId>
+                                                               
<groupId>${project.groupId}</groupId>
+                                                               
<version>${project.version}</version>
+                                                               <file>
+                                                                       
${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib/${project.artifactId}-${project.version}.jar
+                                                               </file>
+                                                       </configuration>
+                                               </execution>
+                                       </executions>
+                               </plugin>
+                       </plugins>
                </pluginManagement>
        </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java
----------------------------------------------------------------------
diff --git 
a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java 
b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java
index 74c57b2..d60b434 100644
--- a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java
+++ b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java
@@ -2,6 +2,7 @@ package com.nearinfinity.blur.gui;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Properties;
 
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.servlet.ServletHolder;
@@ -13,81 +14,112 @@ import com.nearinfinity.blur.metrics.BlurMetrics;
 
 /**
  * Starts up a Jetty server to run the utility gui
+ * 
  * @author gman
- *
+ * 
  */
 public class HttpJettyServer {
-       
-       private static final Log LOG = LogFactory.getLog(HttpJettyServer.class);
-
-       private Server server = null;
-       
-       /**
-        * @param bindPort port of the process that the gui is wrapping
-        * @param port port to run gui on
-        * @param baseControllerPort ports that service runs on
-        * @param baseShardPort
-        * @param baseGuiShardPort port to run gui on
-        * @param baseGuiControllerPort port to run gui on
-        * @param base location of webapp to serve
-        * @param bm metrics object for using.
-        * @throws IOException
-        */
-       //TODO: this got ugly, move to a set/start pattern
-       public HttpJettyServer(int bindPort, int port, int baseControllerPort,
-                       int baseShardPort, int baseGuiControllerPort, int 
baseGuiShardPort,
-                       String base, BlurMetrics bm) throws IOException {
-        server = new Server(port);
-        
-        String blurLogFile = System.getProperty("blur.logs.dir") + "/" + 
System.getProperty("blur.log.file");
-        System.setProperty("blur.gui.servicing.port", bindPort+"");
-        System.setProperty("blur.base.shard.port",baseShardPort+"");
-        System.setProperty("blur.base.controller.port",baseControllerPort+"");
-        System.setProperty("baseGuiShardPort",baseGuiShardPort+"");
-        System.setProperty("baseGuiControllerPort",baseGuiControllerPort+"");
-        System.setProperty("blur.gui.mode", base);
-        LOG.info("System props:" + System.getProperties().toString());
-
-        WebAppContext context = new WebAppContext();
-        context.setWar(getJarFolder() + 
"../src/blur-gui/src/main/webapps/controller");// + base);
-        context.setContextPath("/");
-        context.setParentLoaderPriority(true);
-        //servlets
-        context.addServlet(new ServletHolder(new MetricsServlet(bm)), 
"/metrics");
-        context.addServlet(new ServletHolder(new LogServlet(blurLogFile)), 
"/logs");
-        
-        LOG.info("WEB GUI coming up for resource: " + base);
-        LOG.info("WEB GUI thinks its at: " + getJarFolder());
-        LOG.info("WEB GUI log file being exposed: " + blurLogFile);
-        
-        server.setHandler(context);
- 
-        try {
-                       server.start();
-               } catch (Exception e) {
-                       throw new IOException("cannot start Http server for " + 
base, e);
-               }
-        LOG.info("WEB GUI up on port: " + port);
-       }
-       
-         private String getJarFolder() {
-                   String name = this.getClass().getName().replace('.', '/');
-                   String s = this.getClass().getResource("/" + name + 
".class").toString();
-                   s = s.replace('/', File.separatorChar);
-                   s = s.substring(0, s.indexOf(".jar")+4);
-                   s = s.substring(s.lastIndexOf(':')+1);
-                   return s.substring(0, s.lastIndexOf(File.separatorChar)+1);
-                 } 
-       
-       public void close() {
-               if(server != null)
-                       try {
-                               LOG.info("stopping web server");
-                               server.stop();
-                               LOG.info("stopped web server");
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-       }
-       
+
+  private static final Log LOG = LogFactory.getLog(HttpJettyServer.class);
+
+  private Server server = null;
+
+  /**
+   * @param bindPort
+   *          port of the process that the gui is wrapping
+   * @param port
+   *          port to run gui on
+   * @param baseControllerPort
+   *          ports that service runs on
+   * @param baseShardPort
+   * @param baseGuiShardPort
+   *          port to run gui on
+   * @param baseGuiControllerPort
+   *          port to run gui on
+   * @param base
+   *          location of webapp to serve
+   * @param bm
+   *          metrics object for using.
+   * @throws IOException
+   */
+  public HttpJettyServer(int bindPort, int port, int baseControllerPort, int 
baseShardPort, int baseGuiControllerPort, int baseGuiShardPort, String base, 
BlurMetrics bm)
+      throws IOException {
+    server = new Server(port);
+
+    String logDir = System.getProperty("blur.logs.dir");
+    String logFile = System.getProperty("blur.log.file");
+    String blurLogFile = logDir + "/" + logFile;
+    System.setProperty("blur.gui.servicing.port", bindPort + "");
+    System.setProperty("blur.base.shard.port", baseShardPort + "");
+    System.setProperty("blur.base.controller.port", baseControllerPort + "");
+    System.setProperty("baseGuiShardPort", baseGuiShardPort + "");
+    System.setProperty("baseGuiControllerPort", baseGuiControllerPort + "");
+    System.setProperty("blur.gui.mode", base);
+    LOG.info("System props:" + System.getProperties().toString());
+
+    WebAppContext context = new WebAppContext();
+    String warPath = getWarFolder();
+    context.setWar(warPath);
+    context.setContextPath("/");
+    context.setParentLoaderPriority(true);
+    context.addServlet(new ServletHolder(new MetricsServlet(bm)), "/metrics");
+    context.addServlet(new ServletHolder(new LogServlet(blurLogFile)), 
"/logs");
+
+    LOG.info("WEB GUI coming up for resource: " + base);
+    LOG.info("WEB GUI thinks its at: " + warPath);
+    LOG.info("WEB GUI log file being exposed: " + logDir == null ? "STDOUT" : 
blurLogFile);
+
+    server.setHandler(context);
+
+    try {
+      server.start();
+    } catch (Exception e) {
+      throw new IOException("cannot start Http server for " + base, e);
+    }
+    LOG.info("WEB GUI up on port: " + port);
+  }
+
+  private static String findBlurGuiInClassPath() {
+    Properties properties = System.getProperties();
+    String cp = (String) properties.get("java.class.path");
+    String[] split = cp.split(":");
+    for (String s : split) {
+      if (s.endsWith(".war")) {
+        return s;
+      }
+    }
+    return null;
+  }
+
+  private String getWarFolder() {
+    String findBlurGuiInClassPath = findBlurGuiInClassPath();
+    if (findBlurGuiInClassPath != null) {
+      return findBlurGuiInClassPath;
+    }
+    String name = getClass().getName().replace('.', '/');
+    String classResource = "/" + name + ".class";
+    String pathToClassResource = 
getClass().getResource(classResource).toString();
+    pathToClassResource = pathToClassResource.replace('/', File.separatorChar);
+    int indexOfJar = pathToClassResource.indexOf(".jar");
+    if (indexOfJar < 0) {
+      int index = pathToClassResource.indexOf(name);
+      String pathToClasses = pathToClassResource.substring(0,index);
+      int indexOfProjectName = pathToClasses.indexOf("/blur-gui/");
+      return pathToClasses.substring(0, indexOfProjectName) + 
"/blur-gui/src/main/webapp";
+    }
+    return null;
+  }
+
+  public void close() {
+    if (server != null) {
+      try {
+        LOG.info("stopping web server");
+        server.stop();
+        LOG.info("stopped web server");
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/LogServlet.java
----------------------------------------------------------------------
diff --git 
a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/LogServlet.java 
b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/LogServlet.java
index c1fc283..6fec8cc 100644
--- a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/LogServlet.java
+++ b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/LogServlet.java
@@ -10,71 +10,70 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-
 public class LogServlet extends HttpServlet {
 
-       private static final long serialVersionUID = 1L;
-       private String filePath = null;
-       private int buffLen = 8192;
-       
-       public LogServlet(String filePath) {
-               this.filePath = filePath;
-       }
-
-       protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
-               
-               response.setContentType("text/html");
-               PrintWriter out = response.getWriter();
-               
-               File f = new File(filePath);
-               RandomAccessFile ram = new RandomAccessFile(f, "r");
-
-               String offsetStr = request.getParameter("offset");
-               long offset = -1;
-               if(offsetStr != null)
-                       offset = Long.parseLong(offsetStr);
-
-               long start = 0;
-               long length = ram.length();
-               //figure out buffer
-               if(length < buffLen)
-                       buffLen = new Long(length).intValue();
-               
-               //use offset if passed in
-               if(offset >= 0)
-                       start = offset;
-               else
-                       start = length - buffLen;
-
-               //calc new offset
-               offset = start - buffLen;
-               if(offset < 0)
-                       offset = 0;
-               
-               //buffer
-               byte[] buff = new byte[buffLen];
-               
-               ram.seek(start);
-               ram.read(buff);
-               
-               String returnStr = new String(buff,"UTF-8").replaceAll("\n", 
"\n<br>");
-
-               out.write("<html><link href='style.css' rel='stylesheet' 
type='text/css' /><body>");
-               out.write("<a href='index.html'>home</a><br/>");
-               out.write("<p>File:<b> "+ f.toString() + "</b> (" + start + "/" 
+ length + ")</p>");
-               if(start != 0) {
-                       out.write("<a href='logs?offset=" + 0 + "'>start</a>");
-                       out.write(" <a href='logs?offset=" + offset + 
"'>prev</a>");
-               }
-               if(start + buffLen < length) {
-                       out.write(" <a href='logs?offset=" + (start+buffLen) + 
"'>next</a>");
-                       out.write(" <a href='logs?offset=" + 
((length-buffLen>0)?(length-buffLen):0) + "'>end</a>");
-               }
-               out.write("<br/>");
-               out.write(returnStr);
-               out.write("</body></html>");
-               
-               ram.close();
-       }
-       
+  private static final long serialVersionUID = 1L;
+  private String filePath = null;
+  private int buffLen = 8192;
+
+  public LogServlet(String filePath) {
+    this.filePath = filePath;
+  }
+
+  protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
+
+    response.setContentType("text/html");
+    PrintWriter out = response.getWriter();
+
+    File f = new File(filePath);
+    RandomAccessFile ram = new RandomAccessFile(f, "r");
+
+    String offsetStr = request.getParameter("offset");
+    long offset = -1;
+    if (offsetStr != null)
+      offset = Long.parseLong(offsetStr);
+
+    long start = 0;
+    long length = ram.length();
+    // figure out buffer
+    if (length < buffLen)
+      buffLen = new Long(length).intValue();
+
+    // use offset if passed in
+    if (offset >= 0)
+      start = offset;
+    else
+      start = length - buffLen;
+
+    // calc new offset
+    offset = start - buffLen;
+    if (offset < 0)
+      offset = 0;
+
+    // buffer
+    byte[] buff = new byte[buffLen];
+
+    ram.seek(start);
+    ram.read(buff);
+
+    String returnStr = new String(buff, "UTF-8").replaceAll("\n", "\n<br>");
+
+    out.write("<html><link href='style.css' rel='stylesheet' type='text/css' 
/><body>");
+    out.write("<a href='index.html'>home</a><br/>");
+    out.write("<p>File:<b> " + f.toString() + "</b> (" + start + "/" + length 
+ ")</p>");
+    if (start != 0) {
+      out.write("<a href='logs?offset=" + 0 + "'>start</a>");
+      out.write(" <a href='logs?offset=" + offset + "'>prev</a>");
+    }
+    if (start + buffLen < length) {
+      out.write(" <a href='logs?offset=" + (start + buffLen) + "'>next</a>");
+      out.write(" <a href='logs?offset=" + ((length - buffLen > 0) ? (length - 
buffLen) : 0) + "'>end</a>");
+    }
+    out.write("<br/>");
+    out.write(returnStr);
+    out.write("</body></html>");
+
+    ram.close();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/MetricsServlet.java
----------------------------------------------------------------------
diff --git 
a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/MetricsServlet.java 
b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/MetricsServlet.java
index b901128..e8deae9 100644
--- a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/MetricsServlet.java
+++ b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/MetricsServlet.java
@@ -13,24 +13,23 @@ import org.codehaus.jackson.map.ObjectMapper;
 import com.nearinfinity.blur.metrics.BlurMetrics;
 
 public class MetricsServlet extends HttpServlet {
-       
-       private static final long serialVersionUID = 1L;
 
-       private BlurMetrics bm = null;
+  private static final long serialVersionUID = 1L;
 
-       public MetricsServlet() {
-       }
+  private BlurMetrics bm = null;
 
-       
-       public MetricsServlet(BlurMetrics bm) {
-               this.bm = bm;
-       }
+  public MetricsServlet() {
+  }
 
-       protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
-               response.setContentType("application/json");
-               PrintWriter out = response.getWriter();
-               ObjectMapper mapper = new ObjectMapper();
-               mapper.writeValue(out, bm);
-       }
+  public MetricsServlet(BlurMetrics bm) {
+    this.bm = bm;
+  }
+
+  protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
+    response.setContentType("application/json");
+    PrintWriter out = response.getWriter();
+    ObjectMapper mapper = new ObjectMapper();
+    mapper.writeValue(out, bm);
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0d535c7/src/blur-gui/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapp/WEB-INF/web.xml 
b/src/blur-gui/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..a35ac56
--- /dev/null
+++ b/src/blur-gui/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+       version="2.5">
+
+       <display-name>Blur GUI</display-name>
+</web-app>
\ No newline at end of file

Reply via email to