Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse McConnell2009-09-21 19:03:52 +0000
committerJesse McConnell2009-09-21 19:03:52 +0000
commit9a40cc7e7800ffe391c6db0f8edc3d1c86b954fd (patch)
tree588065008588e43919977edc5c6e975e350c598f
parentd6c76a455acd484c9966428b8305d163cce1c96d (diff)
parent16dc3c6fdbf6c9efd4d700b03ed4f6e7ec6f1d71 (diff)
downloadorg.eclipse.jetty.project-9a40cc7e7800ffe391c6db0f8edc3d1c86b954fd.tar.gz
org.eclipse.jetty.project-9a40cc7e7800ffe391c6db0f8edc3d1c86b954fd.tar.xz
org.eclipse.jetty.project-9a40cc7e7800ffe391c6db0f8edc3d1c86b954fd.zip
[maven-release-plugin] copy for tag jetty-7.0.0.RC6jetty-7.0.0.RC6
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/tags/jetty-7.0.0.RC6@944 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--VERSION.txt4
-rw-r--r--jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java11
-rw-r--r--jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java1
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java18
-rw-r--r--jetty-servlet/src/test/java/org/eclipse/jetty/servlet/StatisticsServletTest.java102
5 files changed, 117 insertions, 19 deletions
diff --git a/VERSION.txt b/VERSION.txt
index beb8bee505..10157bc5e4 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,4 +1,6 @@
-jetty-7.0.0.RC6 September 18th 2009
+jetty-7.0.0.RC6 September 21 2009
+ + 289958 StatisticsServlet incorrectly adds StatisticsHandler
+ + Remove printlns from jetty-plus
+ JETTY-719 Document state machine of jetty http client
+ JETTY-780 CNFE during startup of webapp with spring-context >= 2.5.1
+ JETTY-936 274251 Improved servlet matching and optimized'
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
index bab996a064..2c03312645 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
@@ -237,12 +237,10 @@ public class Injection
{
try
{
- System.err.println("Value to inject="+lookupInjectedValue());
boolean accessibility = field.isAccessible();
field.setAccessible(true);
field.set(injectable, lookupInjectedValue());
field.setAccessible(accessibility);
- System.err.println("Injected field "+_fieldName+" of class "+_className);
}
catch (Exception e)
{
@@ -265,12 +263,10 @@ public class Injection
{
try
{
- System.err.println("Value to inject="+lookupInjectedValue());
boolean accessibility = method.isAccessible();
method.setAccessible(true);
method.invoke(injectable, new Object[] {lookupInjectedValue()});
method.setAccessible(accessibility);
- System.err.println("Injected method "+_methodName+" of class "+_className);
}
catch (Exception e)
{
@@ -311,14 +307,12 @@ public class Injection
if (_targetClass == null)
_targetClass = Loader.loadClass(null, _className);
- System.err.println("Loaded target class "+_targetClass.getName());
-
- System.err.println("Looking for method "+_methodName +" with argument of type "+_paramCanonicalName+" on class "+_className);
+
Class arg = TypeUtil.fromName(_paramCanonicalName);
if (arg == null)
arg = Loader.loadClass(null, _paramCanonicalName);
- System.err.println("Loaded type: "+arg.getName());
+
_target = _targetClass.getDeclaredMethod(_methodName, new Class[] {arg});
}
@@ -331,7 +325,6 @@ public class Injection
//JavaEE spec sec 5.2.4
if (_annotationResourceType != null)
{
- System.err.println("Validating against annotationResourceType="+_annotationResourceType);
if (_target == null)
return false;
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
index 1ac9876d8b..0554901f46 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
@@ -109,7 +109,6 @@ public abstract class LifeCycleCallback
getTarget().setAccessible(true);
getTarget().invoke(instance, __EMPTY_ARGS);
getTarget().setAccessible(accessibility);
- System.err.println("Calling callback on "+_className+"."+_methodName);
}
}
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 94d649107c..5fe3f98455 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
@@ -39,8 +39,6 @@ public class StatisticsServlet extends HttpServlet
public void init() throws ServletException
{
- _memoryBean = ManagementFactory.getMemoryMXBean();
-
ServletContext context = getServletContext();
ContextHandler.Context scontext = (ContextHandler.Context) context;
Server _server = scontext.getContextHandler().getServer();
@@ -53,12 +51,11 @@ public class StatisticsServlet extends HttpServlet
}
else
{
- Log.info("Installing Statistics Handler");
- _statsHandler = new StatisticsHandler();
- _server.setHandler(_statsHandler);
+ Log.warn("Statistics Handler not installed!");
+ return;
}
-
-
+
+ _memoryBean = ManagementFactory.getMemoryMXBean();
_connectors = _server.getConnectors();
if (getInitParameter("restrictToLocalhost") != null)
@@ -75,7 +72,12 @@ public class StatisticsServlet extends HttpServlet
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
-
+ if (_statsHandler == null)
+ {
+ Log.warn("Statistics Handler not installed!");
+ resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+ return;
+ }
if (_restrictToLocalhost)
{
if (!"127.0.0.1".equals(req.getRemoteAddr()))
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/StatisticsServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/StatisticsServletTest.java
new file mode 100644
index 0000000000..0c4fae7fa7
--- /dev/null
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/StatisticsServletTest.java
@@ -0,0 +1,102 @@
+// ========================================================================
+// Copyright (c) 2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+package org.eclipse.jetty.servlet;
+
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.LocalConnector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.StatisticsHandler;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+public class StatisticsServletTest extends TestCase
+{
+ Server server;
+ LocalConnector connector;
+ ServletContextHandler context;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ server = new Server();
+ server.setSendServerVersion(false);
+ context = new ServletContextHandler();
+ context.setContextPath("/");
+ ServletHolder holder = new ServletHolder();
+ holder.setServlet(new org.eclipse.jetty.servlet.StatisticsServlet());
+ holder.setInitParameter("restrictToLocalhost", "false");
+ context.addServlet(holder, "/stats");
+
+ server.setHandler(context);
+ connector = new LocalConnector();
+ server.addConnector(connector);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (server != null)
+ {
+ server.stop();
+ }
+ }
+
+
+ public void testNoHandler () throws Exception
+ {
+ server.start();
+
+ StringBuffer req1 = new StringBuffer();
+ req1.append("GET /stats HTTP/1.1\n");
+ req1.append("Host: localhost\n");
+ req1.append("\n");
+
+ String response = connector.getResponses(req1.toString());
+ assertResponseContains("503", response);
+ }
+
+ public void testWithHandler () throws Exception
+ {
+ StatisticsHandler statsHandler = new StatisticsHandler();
+ statsHandler.setHandler(context);
+ server.setHandler(statsHandler);
+ server.start();
+
+ StringBuffer req1 = new StringBuffer();
+ req1.append("GET /stats HTTP/1.1\n");
+ req1.append("Host: localhost\n");
+ req1.append("\n");
+
+ String response = connector.getResponses(req1.toString());
+ assertResponseContains("Statistics gathering started ", response);
+ }
+
+
+ private void assertResponseContains(String expected, String response)
+ {
+ int idx = response.indexOf(expected);
+ if (idx == (-1))
+ {
+ // Not found
+ StringBuffer err = new StringBuffer();
+ err.append("Response does not contain expected string \"").append(expected).append("\"");
+ err.append("\n").append(response);
+
+ System.err.println(err);
+ throw new AssertionFailedError(err.toString());
+ }
+ }
+}

Back to the top