jetty-9 xml configurations

This commit is contained in:
Greg Wilkins 2012-09-13 14:43:03 +10:00
parent c709981aa5
commit 9940796a32
23 changed files with 242 additions and 110 deletions

View File

@ -77,7 +77,7 @@ public class LikeJettyXml
sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore"); sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g"); sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setTrustStore(jetty_home + "/etc/keystore"); sslContextFactory.setTrustStorePath(jetty_home + "/etc/keystore");
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setExcludeCipherSuites( sslContextFactory.setExcludeCipherSuites(
new String[]{ new String[]{

View File

@ -0,0 +1,19 @@
package org.eclipse.jetty.embedded;
import org.eclipse.jetty.xml.XmlConfiguration;
public class TestXml
{
public static void main(String[] args) throws Exception
{
System.setProperty("jetty.home","../jetty-distribution/target/distribution");
XmlConfiguration.main(new String[]
{
"../jetty-jmx/src/main/config/etc/jetty-jmx.xml",
"../jetty-server/src/main/config/etc/jetty.xml",
"../jetty-spdy/spdy-jetty-http-webapp/src/main/config/etc/jetty-spdy.xml"
}
);
}
}

View File

@ -349,6 +349,12 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId> <artifactId>jetty-annotations</artifactId>

View File

@ -100,6 +100,12 @@
<artifactId>jetty-http</artifactId> <artifactId>jetty-http</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-xml</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId> <artifactId>jetty-jmx</artifactId>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== --> <!-- =============================================================== -->
<!-- Configure SSL for the Jetty Server --> <!-- Configure SSL for the Jetty Server -->
@ -11,25 +11,52 @@
<!-- =============================================================== --> <!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector --> <!-- =========================================================== -->
<!-- Setup a SSL Context factory -->
<New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory"> <!-- =========================================================== -->
<Set name="KeyStore"><Property name="jetty.home" default="." />/etc/keystore</Set> <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set> <Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set> <Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="TrustStore"><Property name="jetty.home" default="." />/etc/keystore</Set> <Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set> <Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New> </New>
<!-- =========================================================== -->
<!-- Add HTTP Customizer for Secure request -->
<!-- =========================================================== -->
<Ref id="httpConfig">
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</Ref>
<Call name="addConnector"> <!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call id="sslConnector" name="addConnector">
<Arg> <Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector"> <New class="org.eclipse.jetty.server.SelectChannelConnector">
<Arg><Ref id="sslContextFactory" /></Arg> <Arg name="server"><Ref id="Server" /></Arg>
<Set name="Port">8443</Set> <Arg name="factories">
<Set name="idleTimeout">30000</Set> <Array type="org.eclipse.jetty.server.ConnectionFactory">
<Set name="Acceptors">2</Set> <Item>
<Set name="AcceptQueueSize">100</Set> <New class="org.eclipse.jetty.server.SslConnectionFactory">
</New> <Arg name="next">http/1.1</Arg>
<Arg name="sslContextFactory"><Ref id="sslContextFactory"/></Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref id="httpConfig"/></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port">8443</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg> </Arg>
</Call> </Call>
</Configure> </Configure>

View File

@ -29,6 +29,21 @@
</Arg> </Arg>
<Arg name="container"><Ref id="Container"/></Arg> <Arg name="container"><Ref id="Container"/></Arg>
<!-- =========================================================== -->
<!-- HttpChannel Configuration -->
<!-- =========================================================== -->
<New id="httpConfig" class="org.eclipse.jetty.server.HttpChannelConfig">
<Set name="secureScheme">https</Set>
<Set name="securePort">8443</Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
</Call>
</New>
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- Set connectors --> <!-- Set connectors -->
<!-- =========================================================== --> <!-- =========================================================== -->
@ -36,6 +51,13 @@
<Arg> <Arg>
<New class="org.eclipse.jetty.server.SelectChannelConnector"> <New class="org.eclipse.jetty.server.SelectChannelConnector">
<Arg name="server"><Ref id="Server" /></Arg> <Arg name="server"><Ref id="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item><New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref id="httpConfig"/></Arg>
</New></Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set> <Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set> <Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="idleTimeout">30000</Set> <Set name="idleTimeout">30000</Set>
@ -68,7 +90,7 @@
<Set name="sendServerVersion">true</Set> <Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set> <Set name="sendDateHeader">true</Set>
<Set name="stopTimeout">1000</Set> <Set name="stopTimeout">1000</Set>
<Set name="dumpAfterStart">false</Set> <Set name="dumpAfterStart">true</Set>
<Set name="dumpBeforeStop">false</Set> <Set name="dumpBeforeStop">false</Set>
</Configure> </Configure>

View File

@ -23,6 +23,7 @@ package org.eclipse.jetty.server;
import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.annotation.Name;
public class HttpConnectionFactory extends AbstractConnectionFactory implements HttpChannelConfig.ConnectionFactory public class HttpConnectionFactory extends AbstractConnectionFactory implements HttpChannelConfig.ConnectionFactory
{ {
@ -34,7 +35,7 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
setInputBufferSize(16384); setInputBufferSize(16384);
} }
public HttpConnectionFactory(HttpChannelConfig config) public HttpConnectionFactory(@Name("config") HttpChannelConfig config)
{ {
super(HttpVersion.HTTP_1_1.toString()); super(HttpVersion.HTTP_1_1.toString());
_config=config; _config=config;

View File

@ -37,6 +37,7 @@ import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.SelectorManager.ManagedSelector; import org.eclipse.jetty.io.SelectorManager.ManagedSelector;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.util.thread.Scheduler;
@ -55,35 +56,50 @@ public class SelectChannelConnector extends AbstractNetworkConnector
private volatile int _lingerTime = -1; private volatile int _lingerTime = -1;
public SelectChannelConnector(Server server) public SelectChannelConnector(
@Name("server") Server server)
{ {
this(server,null,null,null,0,0,new HttpConnectionFactory()); this(server,null,null,null,0,0,new HttpConnectionFactory());
} }
public SelectChannelConnector(Server server,ConnectionFactory... factories) public SelectChannelConnector(
@Name("server") Server server,
@Name("factories") ConnectionFactory... factories)
{ {
this(server,null,null,null,0,0,factories); this(server,null,null,null,0,0,factories);
} }
public SelectChannelConnector(Server server,SslContextFactory sslContextFactory) public SelectChannelConnector(
@Name("server") Server server,
@Name("sslContextFactory") SslContextFactory sslContextFactory)
{ {
this(server,null,null,null,0,0,AbstractConnectionFactory.getFactories(sslContextFactory,new HttpConnectionFactory())); this(server,null,null,null,0,0,AbstractConnectionFactory.getFactories(sslContextFactory,new HttpConnectionFactory()));
} }
public SelectChannelConnector(Server server,SslContextFactory sslContextFactory,ConnectionFactory... factories) public SelectChannelConnector(
@Name("server") Server server,
@Name("sslContextFactory") SslContextFactory sslContextFactory,
@Name("factories") ConnectionFactory... factories)
{ {
this(server,null,null,null,0,0,AbstractConnectionFactory.getFactories(sslContextFactory,factories)); this(server,null,null,null,0,0,AbstractConnectionFactory.getFactories(sslContextFactory,factories));
} }
/** /**
* @param server The server this connector will be added to. Must not be null. * @param server The server this connector will be added to. Must not be null.
* @param factory TODO
* @param executor An executor for this connector or null to use the servers executor * @param executor An executor for this connector or null to use the servers executor
* @param scheduler A scheduler for this connector or null to use the servers scheduler * @param scheduler A scheduler for this connector or null to use the servers scheduler
* @param pool A buffer pool for this connector or null to use a default {@link ByteBufferPool} * @param pool A buffer pool for this connector or null to use a default {@link ByteBufferPool}
* @param acceptors the number of acceptor threads to use, or 0 for a default value. * @param acceptors the number of acceptor threads to use, or 0 for a default value.
* @param factories Zero or more {@link ConnectionFactory} instances.
*/ */
public SelectChannelConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool pool, int acceptors,int selectors,ConnectionFactory... factories) public SelectChannelConnector(
@Name("server") Server server,
@Name("executor") Executor executor,
@Name("scheduler") Scheduler scheduler,
@Name("bufferPool") ByteBufferPool pool,
@Name("acceptors") int acceptors,
@Name("selectors") int selectors,
@Name("factories") ConnectionFactory... factories)
{ {
super(server,executor,scheduler,pool,acceptors,factories); super(server,executor,scheduler,pool,acceptors,factories);
_manager = new ConnectorSelectorManager(selectors > 0 ? selectors : Math.max(1, (Runtime.getRuntime().availableProcessors()) / 4)); _manager = new ConnectorSelectorManager(selectors > 0 ? selectors : Math.max(1, (Runtime.getRuntime().availableProcessors()) / 4));

View File

@ -27,6 +27,7 @@ import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.io.ssl.SslConnection;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
public class SslConnectionFactory extends AbstractConnectionFactory public class SslConnectionFactory extends AbstractConnectionFactory
@ -39,12 +40,12 @@ public class SslConnectionFactory extends AbstractConnectionFactory
this(null,HttpVersion.HTTP_1_1.asString()); this(null,HttpVersion.HTTP_1_1.asString());
} }
public SslConnectionFactory(String nextProtocol) public SslConnectionFactory(@Name("next") String nextProtocol)
{ {
this(null,nextProtocol); this(null,nextProtocol);
} }
public SslConnectionFactory(SslContextFactory factory,String nextProtocol) public SslConnectionFactory(@Name("sslContextFactory") SslContextFactory factory, @Name("next") String nextProtocol)
{ {
super("SSL-"+nextProtocol); super("SSL-"+nextProtocol);
_sslContextFactory=factory==null?new SslContextFactory():factory; _sslContextFactory=factory==null?new SslContextFactory():factory;

View File

@ -163,6 +163,10 @@ public class DefaultHandler extends AbstractHandler
} }
} }
writer.write("</ul><hr>");
writer.write("<a href=\"http://eclipse.org/jetty\"><img border=0 src=\"/favicon.ico\"/></a>&nbsp;");
writer.write("<a href=\"http://eclipse.org/jetty\">Powered by Jetty:// Java Web Server</a><hr/>\n");
writer.write("\n</BODY>\n</HTML>\n"); writer.write("\n</BODY>\n</HTML>\n");
writer.flush(); writer.flush();
response.setContentLength(writer.size()); response.setContentLength(writer.size());

View File

@ -63,7 +63,7 @@ public class SSLSelectChannelConnectorLoadTest
sslContextFactory.setKeyStorePath(keystorePath); sslContextFactory.setKeyStorePath(keystorePath);
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setKeyManagerPassword("keypwd"); sslContextFactory.setKeyManagerPassword("keypwd");
sslContextFactory.setTrustStore(keystorePath); sslContextFactory.setTrustStorePath(keystorePath);
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
server = new Server(); server = new Server();

View File

@ -103,7 +103,7 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
sslContextFactory.setKeyStorePath(keystorePath); sslContextFactory.setKeyStorePath(keystorePath);
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setKeyManagerPassword("keypwd"); sslContextFactory.setKeyManagerPassword("keypwd");
sslContextFactory.setTrustStore(keystorePath); sslContextFactory.setTrustStorePath(keystorePath);
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory); SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory);

View File

@ -48,7 +48,7 @@ public class SslSelectChannelTimeoutTest extends ConnectorTimeoutTest
sslContextFactory.setKeyStorePath(keystorePath); sslContextFactory.setKeyStorePath(keystorePath);
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setKeyManagerPassword("keypwd"); sslContextFactory.setKeyManagerPassword("keypwd");
sslContextFactory.setTrustStore(keystorePath); sslContextFactory.setTrustStorePath(keystorePath);
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory); SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory);
connector.setIdleTimeout(MAX_IDLE_TIME); //250 msec max idle connector.setIdleTimeout(MAX_IDLE_TIME); //250 msec max idle

View File

@ -63,7 +63,7 @@ public class SslUploadTest
sslContextFactory.setKeyStorePath(keystorePath); sslContextFactory.setKeyStorePath(keystorePath);
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setKeyManagerPassword("keypwd"); sslContextFactory.setKeyManagerPassword("keypwd");
sslContextFactory.setTrustStore(keystorePath); sslContextFactory.setTrustStorePath(keystorePath);
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
server = new Server(); server = new Server();

View File

@ -1,17 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"> <!-- =========================================================== -->
<Set name="keyStorePath">src/main/resources/keystore.jks</Set> <!-- Setup a SSL Context factory -->
<Set name="keyStorePassword">storepwd</Set> <!-- =========================================================== -->
<Set name="trustStore">src/main/resources/truststore.jks</Set> <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="trustStorePassword">storepwd</Set> <Set name="KeyStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="protocol">TLSv1</Set> <Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New> <Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<!-- Uncomment to create a ReferrerPushStrategy that can be added to the Connectors <Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
<!-- =========================================================== -->
<!-- Add HTTP Customizer for Secure request -->
<!-- =========================================================== -->
<Ref id="httpConfig">
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</Ref>
<!-- =========================================================== -->
<!-- Create a push strategy -->
<!-- =========================================================== -->
<New id="pushStrategy" class="org.eclipse.jetty.spdy.http.ReferrerPushStrategy"> <New id="pushStrategy" class="org.eclipse.jetty.spdy.http.ReferrerPushStrategy">
<Arg type="List"> <Arg type="List">
<Array type="String"> <Array type="String">
@ -23,66 +37,66 @@
</Array> </Array>
</Arg> </Arg>
</New> </New>
-->
<!--
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
-->
<Call name="addConnector"> <!-- =========================================================== -->
<Arg> <!-- Set connectors -->
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnector"> <!-- =========================================================== -->
<Arg> <Call id="sslConnector" name="addConnector">
<Ref id="Server"/> <Arg>
</Arg> <New class="org.eclipse.jetty.server.SelectChannelConnector">
<!-- Uncomment to enable to apply ReferrerPushStrategy for spdy/3 <Arg name="server"><Ref id="Server" /></Arg>
if you want to support it in both spdy/2 and spdy/3, just replace the <Arg name="factories">
value in the first map entry. <Array type="org.eclipse.jetty.server.ConnectionFactory">
<Arg name="pushStrategies"> <Item>
<Map> <New class="org.eclipse.jetty.server.SslConnectionFactory">
<Entry> <Arg name="next">npn</Arg>
<Item type="short">2</Item> <Arg name="sslContextFactory"><Ref id="sslContextFactory"/></Arg>
<Item><New class="org.eclipse.jetty.spdy.http.PushStrategy$None" /></Item> </New>
</Entry> </Item>
<Entry>
<Item type="short">3</Item> <Item>
<Item><Ref id="pushStrategy" /></Item> <New class="org.eclipse.jetty.spdy.NPNServerConnectionFactory">
</Entry> <Arg name="protocols">
</Map> <Array type="String">
</Arg> <Item>spdy/3</Item>
--> <Item>spdy/2</Item>
<Set name="Port">8080</Set> <Item>http/1.1</Item>
</New> </Array>
</Arg> </Arg>
</Call> <Set name="defaultProtocol">http/1.1</Set>
<Call name="addConnector"> </New>
<Arg> </Item>
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnector">
<Arg> <Item>
<Ref id="Server"/> <New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
</Arg> <Arg name="version" type="int">3</Arg>
<Arg> <Arg name="config"><Ref id="httpConfig"/></Arg>
<Ref id="sslContextFactory"/> <!-- <Arg name="pushStrategy"><Ref id="pushStrategy"/></Arg> -->
</Arg> </New>
<!-- Uncomment to enable to apply ReferrerPushStrategy for spdy/3 </Item>
if you want to support it in both spdy/2 and spdy/3, just replace the
value in the first map entry. <Item>
<Arg name="pushStrategies"> <New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
<Map> <Arg name="version" type="int">2</Arg>
<Entry> <Arg name="config"><Ref id="httpConfig"/></Arg>
<Item type="short">2</Item> </New>
<Item><New class="org.eclipse.jetty.spdy.http.PushStrategy$None" /></Item> </Item>
</Entry>
<Entry> <Item>
<Item type="short">3</Item> <New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Item><Ref id="pushStrategy" /></Item> <Arg name="config"><Ref id="httpConfig"/></Arg>
</Entry> </New>
</Map> </Item>
</Arg> </Array>
--> </Arg>
<Set name="Port">8443</Set> <Set name="host"><Property name="jetty.host" /></Set>
</New> <Set name="port">8443</Set>
</Arg> <Set name="idleTimeout">30000</Set>
</Call> </New>
</Arg>
</Call>
</Configure> </Configure>

View File

@ -31,6 +31,7 @@ import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo; import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener; import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.util.Fields; import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
@ -42,7 +43,17 @@ public class HTTPSPDYServerConnectionFactory extends SPDYServerConnectionFactory
private final PushStrategy pushStrategy; private final PushStrategy pushStrategy;
private final HttpChannelConfig httpChannelConfig; private final HttpChannelConfig httpChannelConfig;
public HTTPSPDYServerConnectionFactory(int version, HttpChannelConfig config, PushStrategy pushStrategy) public HTTPSPDYServerConnectionFactory(
@Name("version") int version,
@Name("config") HttpChannelConfig config)
{
this(version,config,new PushStrategy.None());
}
public HTTPSPDYServerConnectionFactory(
@Name("version") int version,
@Name("config") HttpChannelConfig config,
@Name("pushStrategy") PushStrategy pushStrategy)
{ {
super(version); super(version);
this.pushStrategy = pushStrategy; this.pushStrategy = pushStrategy;

View File

@ -75,7 +75,7 @@ public class ProtocolNegotiationTest
SslContextFactory sslContextFactory = new SslContextFactory(); SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks"); sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setTrustStore("src/test/resources/truststore.jks"); sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
sslContextFactory.setProtocol("TLSv1"); sslContextFactory.setProtocol("TLSv1");
sslContextFactory.setIncludeProtocols("TLSv1"); sslContextFactory.setIncludeProtocols("TLSv1");

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint; import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
import org.eclipse.jetty.server.AbstractConnectionFactory; import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.util.annotation.Name;
public class NPNServerConnectionFactory extends AbstractConnectionFactory public class NPNServerConnectionFactory extends AbstractConnectionFactory
{ {
@ -38,7 +39,7 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
/** /**
* @param protocols List of supported protocols in priority order * @param protocols List of supported protocols in priority order
*/ */
public NPNServerConnectionFactory(String... protocols) public NPNServerConnectionFactory(@Name("protocols")String... protocols)
{ {
super("npn"); super("npn");
_protocols=Arrays.asList(protocols); _protocols=Arrays.asList(protocols);
@ -80,5 +81,10 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
return new NextProtoNegoServerConnection((DecryptedEndPoint)endPoint, connector,protocols,_defaultProtocol); return new NextProtoNegoServerConnection((DecryptedEndPoint)endPoint, connector,protocols,_defaultProtocol);
} }
@Override
public String toString()
{
return String.format("%s@%x{%s,%s,%s}",this.getClass().getSimpleName(),hashCode(),getProtocol(),getDefaultProtocol(),getProtocols());
}
} }

View File

@ -123,7 +123,7 @@ public abstract class AbstractTest
SslContextFactory sslContextFactory = new SslContextFactory(); SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks"); sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setTrustStore("src/test/resources/truststore.jks"); sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
sslContextFactory.setTrustStorePassword("storepwd"); sslContextFactory.setTrustStorePassword("storepwd");
sslContextFactory.setProtocol("TLSv1"); sslContextFactory.setProtocol("TLSv1");
sslContextFactory.setIncludeProtocols("TLSv1"); sslContextFactory.setIncludeProtocols("TLSv1");

View File

@ -516,7 +516,7 @@ public class SslContextFactory extends AbstractLifeCycle
* @param trustStorePath * @param trustStorePath
* The file name or URL of the trust store location * The file name or URL of the trust store location
*/ */
public void setTrustStore(String trustStorePath) public void setTrustStorePath(String trustStorePath)
{ {
checkNotStarted(); checkNotStarted();

View File

@ -175,7 +175,7 @@ public class SslContextFactoryTest
{ {
SslContextFactory.LOG.info("EXPECT SslContextFactory@????????(null,/foo): java.lang.IllegalStateException: SSL doesn't have a valid keystore..."); SslContextFactory.LOG.info("EXPECT SslContextFactory@????????(null,/foo): java.lang.IllegalStateException: SSL doesn't have a valid keystore...");
((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true); ((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true);
cf.setTrustStore("/foo"); cf.setTrustStorePath("/foo");
cf.start(); cf.start();
Assert.fail(); Assert.fail();
} }

View File

@ -754,9 +754,9 @@ public class XmlConfiguration
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("XML new " + oClass); LOG.debug("XML new " + oClass);
Object n;
try try
{ {
Object n;
if (namedArgMap.size() > 0) if (namedArgMap.size() > 0)
{ {
LOG.debug("using named mapping"); LOG.debug("using named mapping");
@ -767,14 +767,13 @@ public class XmlConfiguration
LOG.debug("using normal mapping"); LOG.debug("using normal mapping");
n = TypeUtil.construct(oClass, arguments.toArray()); n = TypeUtil.construct(oClass, arguments.toArray());
} }
configure(n,node,argIndex);
return n;
} }
catch (NoSuchMethodException e) catch (NoSuchMethodException e)
{ {
throw new IllegalStateException("No suitable constructor: " + node + " on " + obj); throw new IllegalStateException("No suitable constructor: " + node + " on " + obj);
} }
configure(n,node,argIndex);
return n;
} }
/* /*

View File

@ -97,7 +97,7 @@ public class TestServer
cf.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore"); cf.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g"); cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
cf.setTrustStore(jetty_root + "/jetty-server/src/main/config/etc/keystore"); cf.setTrustStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
cf.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); cf.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
server.addConnector(ssl_connector); server.addConnector(ssl_connector);