From ddce31a323c152c382a6d5d062e4fbbfe3e46f90 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 29 Jan 2013 14:48:25 -0600 Subject: [PATCH 1/5] [Bug 396574] add JETTY_HOME as a location for pid to be found --- jetty-distribution/src/main/resources/bin/jetty.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-distribution/src/main/resources/bin/jetty.sh b/jetty-distribution/src/main/resources/bin/jetty.sh index 2d8898832dc..4be89599d13 100755 --- a/jetty-distribution/src/main/resources/bin/jetty.sh +++ b/jetty-distribution/src/main/resources/bin/jetty.sh @@ -68,7 +68,8 @@ # # JETTY_RUN # Where the jetty.pid file should be stored. It defaults to the -# first available of /var/run, /usr/var/run, and /tmp if not set. +# first available of /var/run, /usr/var/run, JETTY_HOME and /tmp +# if not set. # # JETTY_PID # The Jetty PID file, defaults to $JETTY_RUN/jetty.pid From 1910fb8ce42a41e0dba9a7aa742d7534038a852a Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 29 Jan 2013 14:55:22 -0600 Subject: [PATCH 2/5] [Bug 391345] fix missing br tag in statistics servlet --- .../main/java/org/eclipse/jetty/servlet/StatisticsServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java index 1c1ebf0195e..f63d3f291d2 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java @@ -201,7 +201,7 @@ public class StatisticsServlet extends HttpServlet { sb.append("Statistics gathering started ").append(connector.getStatsOnMs()).append("ms ago").append("
\n"); sb.append("Total connections: ").append(connector.getConnections()).append("
\n"); - sb.append("Current connections open: ").append(connector.getConnectionsOpen()); + sb.append("Current connections open: ").append(connector.getConnectionsOpen()).append("
\n"); sb.append("Max concurrent connections open: ").append(connector.getConnectionsOpenMax()).append("
\n"); sb.append("Total connections duration: ").append(connector.getConnectionsDurationTotal()).append("
\n"); sb.append("Mean connection duration: ").append(connector.getConnectionsDurationMean()).append("
\n"); From 840f1470196e8fd99fa4b31d8ef965eb8d8f1fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KARASZI=20Istva=CC=81n?= Date: Mon, 8 Oct 2012 13:33:16 +0200 Subject: [PATCH 3/5] [Bug 391248] fixing localhost checking in statistics servlet Signed-off-by: Jesse McConnell --- .../java/org/eclipse/jetty/servlet/StatisticsServlet.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java index f63d3f291d2..cde02cc8ffa 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java @@ -89,7 +89,7 @@ public class StatisticsServlet extends HttpServlet } if (_restrictToLocalhost) { - if (!"127.0.0.1".equals(req.getRemoteAddr())) + if (!isLoopbackAddress(req.getRemoteAddr())) { resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); return; @@ -111,6 +111,12 @@ public class StatisticsServlet extends HttpServlet } + private boolean isLoopbackAddress(String address) + { + InetAddress address = InetAddress.getByName(address); + return address.isLoopbackAddress(); + } + private void sendXmlResponse(HttpServletResponse response) throws IOException { StringBuilder sb = new StringBuilder(); From dd4a80288be67e548c2e30e5f36506de752a0da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KARASZI=20Istva=CC=81n?= Date: Mon, 8 Oct 2012 13:36:23 +0200 Subject: [PATCH 4/5] [Bug 391249] fix for invalid XML node dispatchedTimeMean in statistics servlet Signed-off-by: Jesse McConnell --- .../main/java/org/eclipse/jetty/servlet/StatisticsServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java index cde02cc8ffa..5f5c1b9f881 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java @@ -138,7 +138,7 @@ public class StatisticsServlet extends HttpServlet sb.append(" ").append(_statsHandler.getDispatchedActive()).append("\n"); sb.append(" ").append(_statsHandler.getDispatchedActiveMax()).append("\n"); sb.append(" ").append(_statsHandler.getDispatchedTimeTotal()).append("\n"); - sb.append(" \n"); + sb.append(" ").append(_statsHandler.getDispatchedTimeMean()).append("\n"); sb.append(" ").append(_statsHandler.getDispatchedTimeMax()).append("\n"); sb.append(" \n"); From c87cc4d4f09d06d44be1f056412a7baf7b2c758c Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 29 Jan 2013 15:48:33 -0600 Subject: [PATCH 5/5] resolve compilation issues with statistics servlet post patch application --- .../eclipse/jetty/servlet/StatisticsServlet.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java index 5f5c1b9f881..29dc04bf75a 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; +import java.net.InetAddress; +import java.net.UnknownHostException; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -113,8 +115,16 @@ public class StatisticsServlet extends HttpServlet private boolean isLoopbackAddress(String address) { - InetAddress address = InetAddress.getByName(address); - return address.isLoopbackAddress(); + try + { + InetAddress addr = InetAddress.getByName(address); + return addr.isLoopbackAddress(); + } + catch (UnknownHostException e ) + { + LOG.warn("Warning: attempt to access statistics servlet from " + address, e); + return false; + } } private void sendXmlResponse(HttpServletResponse response) throws IOException