[AMQ-5517] Start stubbing in some of the extra params and such that will be needed to support jetty 9

This commit is contained in:
Daniel Kulp 2015-01-13 09:14:14 -05:00
parent 2c68116158
commit bc2e2d9a41
10 changed files with 14 additions and 39 deletions

View File

@ -22,6 +22,7 @@ import org.apache.activemq.broker.SslContext;
import org.apache.activemq.transport.https.Krb5AndCertsSslSocketConnector;
import org.apache.activemq.util.IntrospectionSupport;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ssl.SslConnector;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -49,7 +50,7 @@ public class SecureSocketConnectorFactory extends SocketConnectorFactory {
}
@Override
public Connector createConnector() throws Exception {
public Connector createConnector(Server server) throws Exception {
IntrospectionSupport.setProperties(this, getTransportOptions());
SslConnector sslConnector;
if (Krb5AndCertsSslSocketConnector.isKrb(auth)) {

View File

@ -20,13 +20,14 @@ import java.util.Map;
import org.apache.activemq.util.IntrospectionSupport;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
public class SocketConnectorFactory {
private Map<String, Object> transportOptions;
public Connector createConnector() throws Exception {
public Connector createConnector(Server server) throws Exception {
SelectChannelConnector connector = new SelectChannelConnector();
IntrospectionSupport.setProperties(connector, transportOptions, "");
return connector;

View File

@ -79,7 +79,7 @@ public class HttpTransportServer extends WebTransportServerSupport {
protected void doStart() throws Exception {
server = new Server();
if (connector == null) {
connector = socketConnectorFactory.createConnector();
connector = socketConnectorFactory.createConnector(server);
}
URI boundTo = bind();

View File

@ -21,23 +21,12 @@ import java.net.URI;
import org.apache.activemq.broker.SslContext;
import org.apache.activemq.transport.SecureSocketConnectorFactory;
import org.apache.activemq.transport.http.HttpTransportServer;
import org.eclipse.jetty.server.Connector;
public class HttpsTransportServer extends HttpTransportServer {
private SslContext context;
public HttpsTransportServer(URI uri, HttpsTransportFactory factory, SslContext context) {
super(uri, factory);
this.context = context;
this.socketConnectorFactory = new SecureSocketConnectorFactory(context);
}
public void doStart() throws Exception {
Connector sslConnector = socketConnectorFactory.createConnector();
setConnector(sslConnector);
super.doStart();
}
}

View File

@ -52,7 +52,7 @@ public class WSTransportServer extends WebTransportServerSupport {
server = new Server();
if (connector == null) {
connector = socketConnectorFactory.createConnector();
connector = socketConnectorFactory.createConnector(server);
}
URI boundTo = bind();

View File

@ -21,24 +21,12 @@ import java.net.URI;
import org.apache.activemq.broker.SslContext;
import org.apache.activemq.transport.SecureSocketConnectorFactory;
import org.apache.activemq.transport.ws.WSTransportServer;
import org.eclipse.jetty.server.Connector;
public class WSSTransportServer extends WSTransportServer {
private SslContext context;
public WSSTransportServer(URI location, SslContext context) {
super(location);
this.context = context;
this.socketConnectorFactory = new SecureSocketConnectorFactory(context);
}
@Override
protected void doStart() throws Exception {
Connector sslConnector = socketConnectorFactory.createConnector();
setConnector(sslConnector);
super.doStart();
}
}

View File

@ -96,7 +96,7 @@ public class WSTransportTest {
protected Server createWebServer() throws Exception {
Server server = new Server();
Connector connector = createJettyConnector();
Connector connector = createJettyConnector(server);
connector.setServer(server);
WebAppContext context = new WebAppContext();
@ -129,7 +129,7 @@ public class WSTransportTest {
return proxyPort;
}
protected Connector createJettyConnector() {
protected Connector createJettyConnector(Server server) {
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(getProxyPort());
return connector;

View File

@ -18,12 +18,13 @@ package org.apache.activemq.transport.wss;
import org.apache.activemq.transport.ws.WSTransportTest;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
public class WSSTransportTest extends WSTransportTest {
@Override
protected Connector createJettyConnector() {
protected Connector createJettyConnector(Server server) {
SslSocketConnector sslConnector = new SslSocketConnector();
SslContextFactory contextFactory = sslConnector.getSslContextFactory();
contextFactory.setKeyStorePath("src/test/resources/server.keystore");

View File

@ -19,7 +19,6 @@ package org.apache.activemq.web.tool;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.WebAppContext;
/**
@ -48,10 +47,7 @@ public final class Main {
}
System.out.println("Starting Web Server on port: " + port);
System.setProperty("jetty.port", "" + port);
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(port);
connector.setServer(server);
Server server = new Server(port);
//System.setProperty("webconsole.type","properties");
//System.setProperty("webconsole.jms.url","tcp://localhost:61616");
@ -63,9 +59,6 @@ public final class Main {
context.setContextPath(WEBAPP_CTX);
context.setServer(server);
server.setHandler(context);
server.setConnectors(new Connector[] {
connector
});
server.start();
System.out.println();

View File

@ -74,7 +74,9 @@
<jasypt-version>1.9.2</jasypt-version>
<jaxb-bundle-version>2.2.1.1_2</jaxb-bundle-version>
<jdom-version>1.0</jdom-version>
<jetty-version>8.1.15.v20140411</jetty-version>
<jetty9-version>9.2.6.v20141205</jetty9-version>
<jetty8-version>8.1.16.v20140903</jetty8-version>
<jetty-version>${jetty8-version}</jetty-version>
<jmdns-version>3.4.1</jmdns-version>
<jsp-version>2.1.v20100127</jsp-version>
<jstl-version>1.1.2</jstl-version>