Merge pull request #8893 from eclipse/jetty-12.0.x-ee9-StatisticsServletTest
Re-enable and fix StatisticsServletTest for ee9
This commit is contained in:
commit
4a4ea5b8d8
|
@ -2381,14 +2381,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
{
|
{
|
||||||
CoreContextHandler()
|
CoreContextHandler()
|
||||||
{
|
{
|
||||||
super.setHandler(new Handler.Abstract()
|
super.setHandler(new CoreToNestedHandler());
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public org.eclipse.jetty.server.Request.Processor handle(org.eclipse.jetty.server.Request request) throws Exception
|
|
||||||
{
|
|
||||||
return CoreContextHandler.this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
addBean(ContextHandler.this, true);
|
addBean(ContextHandler.this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2522,5 +2515,14 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
return _apiContext;
|
return _apiContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CoreToNestedHandler extends Abstract
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public org.eclipse.jetty.server.Request.Processor handle(org.eclipse.jetty.server.Request request) throws Exception
|
||||||
|
{
|
||||||
|
return CoreContextHandler.this;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.eclipse.jetty.ee9.nested.ContextHandler;
|
|
||||||
import org.eclipse.jetty.ee9.nested.SessionHandler;
|
import org.eclipse.jetty.ee9.nested.SessionHandler;
|
||||||
import org.eclipse.jetty.ee9.nested.StatisticsHandler;
|
import org.eclipse.jetty.ee9.nested.StatisticsHandler;
|
||||||
import org.eclipse.jetty.http.HttpHeader;
|
import org.eclipse.jetty.http.HttpHeader;
|
||||||
|
@ -41,7 +40,6 @@ import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.util.ajax.JSON;
|
import org.eclipse.jetty.util.ajax.JSON;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
@ -57,7 +55,6 @@ import static org.hamcrest.Matchers.not;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
@Disabled // TODO
|
|
||||||
public class StatisticsServletTest
|
public class StatisticsServletTest
|
||||||
{
|
{
|
||||||
private Server _server;
|
private Server _server;
|
||||||
|
@ -82,12 +79,9 @@ public class StatisticsServletTest
|
||||||
|
|
||||||
private void addStatisticsHandler()
|
private void addStatisticsHandler()
|
||||||
{
|
{
|
||||||
StatisticsHandler statsHandler = new StatisticsHandler();
|
|
||||||
ContextHandler contextHandler = new ContextHandler();
|
|
||||||
contextHandler.setHandler(statsHandler);
|
|
||||||
_server.setHandler(contextHandler);
|
|
||||||
ServletContextHandler statsContext = new ServletContextHandler(_server, "/");
|
ServletContextHandler statsContext = new ServletContextHandler(_server, "/");
|
||||||
statsHandler.setHandler(statsContext);
|
StatisticsHandler statsHandler = new StatisticsHandler();
|
||||||
|
statsContext.insertHandler(statsHandler);
|
||||||
statsContext.addServlet(new ServletHolder(new TestServlet()), "/test1");
|
statsContext.addServlet(new ServletHolder(new TestServlet()), "/test1");
|
||||||
ServletHolder servletHolder = new ServletHolder(new StatisticsServlet());
|
ServletHolder servletHolder = new ServletHolder(new StatisticsServlet());
|
||||||
servletHolder.setInitParameter("restrictToLocalhost", "false");
|
servletHolder.setInitParameter("restrictToLocalhost", "false");
|
||||||
|
|
Loading…
Reference in New Issue