From 2128d4d246f4d9021ef33599279a92fa0b979b5b Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Tue, 13 Jan 2015 13:29:52 -0500 Subject: [PATCH] Fix some itests due to the servlet import range being inadequate for the version of karaf we are testing with --- .../transport/ws/WSTransportServer.java | 17 ++++++++++++----- activemq-web-console/pom.xml | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java index e26027deef..adfa2af4f3 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java @@ -21,6 +21,8 @@ import java.net.InetSocketAddress; import java.net.URI; import java.util.Map; +import javax.servlet.Servlet; + import org.apache.activemq.command.BrokerInfo; import org.apache.activemq.transport.SocketConnectorFactory; import org.apache.activemq.transport.WebTransportServerSupport; @@ -69,11 +71,7 @@ public class WSTransportServer extends WebTransportServerSupport { } } - if (Server.getVersion().startsWith("8")) { - holder.setServlet(new org.apache.activemq.transport.ws.jetty8.WSServlet()); - } else { - holder.setServlet(new org.apache.activemq.transport.ws.jetty9.WSServlet()); - } + holder.setServlet(createWSServlet()); contextHandler.addServlet(holder, "/"); contextHandler.setAttribute("acceptListener", getAcceptListener()); @@ -99,6 +97,15 @@ public class WSTransportServer extends WebTransportServerSupport { LOG.info("Listening for connections at {}", getConnectURI()); } + private Servlet createWSServlet() throws Exception { + if (Server.getVersion().startsWith("9")) { + return (Servlet)Class.forName("org.apache.activemq.transport.ws.jetty9.WSServlet", true, + getClass().getClassLoader()).newInstance(); + } + return (Servlet)Class.forName("org.apache.activemq.transport.ws.jetty8.WSServlet", true, + getClass().getClassLoader()).newInstance(); + } + private int getConnectorLocalPort() throws Exception { return (Integer)connector.getClass().getMethod("getLocalPort").invoke(connector); } diff --git a/activemq-web-console/pom.xml b/activemq-web-console/pom.xml index 258377abe5..21fdec272c 100755 --- a/activemq-web-console/pom.xml +++ b/activemq-web-console/pom.xml @@ -140,9 +140,9 @@ javax.management.remote, javax.naming, org.w3c.dom, - javax.servlet, - javax.servlet.http, - javax.servlet.resources, + javax.servlet;version="[2.5,4)", + javax.servlet.http;version="[2.5,4)", + javax.servlet.resources;version="[2.5,4)", javax.servlet.jsp, javax.servlet.jsp.tagext, javax.servlet.jsp.el,