Fix some itests due to the servlet import range being inadequate for the version of karaf we are testing with

This commit is contained in:
Daniel Kulp 2015-01-13 13:29:52 -05:00
parent d4aff4da64
commit 2128d4d246
2 changed files with 15 additions and 8 deletions

View File

@ -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);
}

View File

@ -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,