jetty-9 xml configurations
This commit is contained in:
parent
c709981aa5
commit
9940796a32
|
@ -77,7 +77,7 @@ public class LikeJettyXml
|
|||
sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
|
||||
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
||||
sslContextFactory.setTrustStore(jetty_home + "/etc/keystore");
|
||||
sslContextFactory.setTrustStorePath(jetty_home + "/etc/keystore");
|
||||
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
sslContextFactory.setExcludeCipherSuites(
|
||||
new String[]{
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
|
@ -349,6 +349,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-plus</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-annotations</artifactId>
|
||||
|
|
|
@ -100,6 +100,12 @@
|
|||
<artifactId>jetty-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-xml</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jmx</artifactId>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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 -->
|
||||
|
@ -11,25 +11,52 @@
|
|||
<!-- =============================================================== -->
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector -->
|
||||
|
||||
<New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory">
|
||||
<Set name="KeyStore"><Property name="jetty.home" default="." />/etc/keystore</Set>
|
||||
<!-- =========================================================== -->
|
||||
<!-- Setup a SSL Context factory -->
|
||||
<!-- =========================================================== -->
|
||||
<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="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>
|
||||
</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>
|
||||
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
|
||||
<Arg><Ref id="sslContextFactory" /></Arg>
|
||||
<Set name="Port">8443</Set>
|
||||
<Set name="idleTimeout">30000</Set>
|
||||
<Set name="Acceptors">2</Set>
|
||||
<Set name="AcceptQueueSize">100</Set>
|
||||
</New>
|
||||
<New class="org.eclipse.jetty.server.SelectChannelConnector">
|
||||
<Arg name="server"><Ref id="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.SslConnectionFactory">
|
||||
<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>
|
||||
</Call>
|
||||
</Configure>
|
||||
|
|
|
@ -29,6 +29,21 @@
|
|||
</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 -->
|
||||
<!-- =========================================================== -->
|
||||
|
@ -36,6 +51,13 @@
|
|||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.SelectChannelConnector">
|
||||
<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="port"><Property name="jetty.port" default="8080"/></Set>
|
||||
<Set name="idleTimeout">30000</Set>
|
||||
|
@ -68,7 +90,7 @@
|
|||
<Set name="sendServerVersion">true</Set>
|
||||
<Set name="sendDateHeader">true</Set>
|
||||
<Set name="stopTimeout">1000</Set>
|
||||
<Set name="dumpAfterStart">false</Set>
|
||||
<Set name="dumpAfterStart">true</Set>
|
||||
<Set name="dumpBeforeStop">false</Set>
|
||||
|
||||
</Configure>
|
||||
|
|
|
@ -23,6 +23,7 @@ package org.eclipse.jetty.server;
|
|||
import org.eclipse.jetty.http.HttpVersion;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
|
||||
public class HttpConnectionFactory extends AbstractConnectionFactory implements HttpChannelConfig.ConnectionFactory
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
|||
setInputBufferSize(16384);
|
||||
}
|
||||
|
||||
public HttpConnectionFactory(HttpChannelConfig config)
|
||||
public HttpConnectionFactory(@Name("config") HttpChannelConfig config)
|
||||
{
|
||||
super(HttpVersion.HTTP_1_1.toString());
|
||||
_config=config;
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.jetty.io.SelectChannelEndPoint;
|
|||
import org.eclipse.jetty.io.SelectorManager;
|
||||
import org.eclipse.jetty.io.SelectorManager.ManagedSelector;
|
||||
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.thread.Scheduler;
|
||||
|
||||
|
@ -55,35 +56,50 @@ public class SelectChannelConnector extends AbstractNetworkConnector
|
|||
private volatile int _lingerTime = -1;
|
||||
|
||||
|
||||
public SelectChannelConnector(Server server)
|
||||
public SelectChannelConnector(
|
||||
@Name("server") Server server)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 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 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);
|
||||
_manager = new ConnectorSelectorManager(selectors > 0 ? selectors : Math.max(1, (Runtime.getRuntime().availableProcessors()) / 4));
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.jetty.http.HttpVersion;
|
|||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class SslConnectionFactory extends AbstractConnectionFactory
|
||||
|
@ -39,12 +40,12 @@ public class SslConnectionFactory extends AbstractConnectionFactory
|
|||
this(null,HttpVersion.HTTP_1_1.asString());
|
||||
}
|
||||
|
||||
public SslConnectionFactory(String nextProtocol)
|
||||
public SslConnectionFactory(@Name("next") String nextProtocol)
|
||||
{
|
||||
this(null,nextProtocol);
|
||||
}
|
||||
|
||||
public SslConnectionFactory(SslContextFactory factory,String nextProtocol)
|
||||
public SslConnectionFactory(@Name("sslContextFactory") SslContextFactory factory, @Name("next") String nextProtocol)
|
||||
{
|
||||
super("SSL-"+nextProtocol);
|
||||
_sslContextFactory=factory==null?new SslContextFactory():factory;
|
||||
|
|
|
@ -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> ");
|
||||
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.flush();
|
||||
response.setContentLength(writer.size());
|
||||
|
|
|
@ -63,7 +63,7 @@ public class SSLSelectChannelConnectorLoadTest
|
|||
sslContextFactory.setKeyStorePath(keystorePath);
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setKeyManagerPassword("keypwd");
|
||||
sslContextFactory.setTrustStore(keystorePath);
|
||||
sslContextFactory.setTrustStorePath(keystorePath);
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
|
||||
server = new Server();
|
||||
|
|
|
@ -103,7 +103,7 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
|
|||
sslContextFactory.setKeyStorePath(keystorePath);
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setKeyManagerPassword("keypwd");
|
||||
sslContextFactory.setTrustStore(keystorePath);
|
||||
sslContextFactory.setTrustStorePath(keystorePath);
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SslSelectChannelTimeoutTest extends ConnectorTimeoutTest
|
|||
sslContextFactory.setKeyStorePath(keystorePath);
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setKeyManagerPassword("keypwd");
|
||||
sslContextFactory.setTrustStore(keystorePath);
|
||||
sslContextFactory.setTrustStorePath(keystorePath);
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory);
|
||||
connector.setIdleTimeout(MAX_IDLE_TIME); //250 msec max idle
|
||||
|
|
|
@ -63,7 +63,7 @@ public class SslUploadTest
|
|||
sslContextFactory.setKeyStorePath(keystorePath);
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setKeyManagerPassword("keypwd");
|
||||
sslContextFactory.setTrustStore(keystorePath);
|
||||
sslContextFactory.setTrustStorePath(keystorePath);
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
|
||||
server = new Server();
|
||||
|
|
|
@ -1,17 +1,31 @@
|
|||
<?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">
|
||||
|
||||
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
|
||||
<Set name="keyStorePath">src/main/resources/keystore.jks</Set>
|
||||
<Set name="keyStorePassword">storepwd</Set>
|
||||
<Set name="trustStore">src/main/resources/truststore.jks</Set>
|
||||
<Set name="trustStorePassword">storepwd</Set>
|
||||
<Set name="protocol">TLSv1</Set>
|
||||
</New>
|
||||
|
||||
<!-- Uncomment to create a ReferrerPushStrategy that can be added to the Connectors
|
||||
<!-- =========================================================== -->
|
||||
<!-- Setup a SSL Context factory -->
|
||||
<!-- =========================================================== -->
|
||||
<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="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
|
||||
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
|
||||
<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">
|
||||
<Arg type="List">
|
||||
<Array type="String">
|
||||
|
@ -23,66 +37,66 @@
|
|||
</Array>
|
||||
</Arg>
|
||||
</New>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
|
||||
-->
|
||||
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnector">
|
||||
<Arg>
|
||||
<Ref id="Server"/>
|
||||
</Arg>
|
||||
<!-- Uncomment to enable to apply ReferrerPushStrategy for spdy/3
|
||||
if you want to support it in both spdy/2 and spdy/3, just replace the
|
||||
value in the first map entry.
|
||||
<Arg name="pushStrategies">
|
||||
<Map>
|
||||
<Entry>
|
||||
<Item type="short">2</Item>
|
||||
<Item><New class="org.eclipse.jetty.spdy.http.PushStrategy$None" /></Item>
|
||||
</Entry>
|
||||
<Entry>
|
||||
<Item type="short">3</Item>
|
||||
<Item><Ref id="pushStrategy" /></Item>
|
||||
</Entry>
|
||||
</Map>
|
||||
</Arg>
|
||||
-->
|
||||
<Set name="Port">8080</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnector">
|
||||
<Arg>
|
||||
<Ref id="Server"/>
|
||||
</Arg>
|
||||
<Arg>
|
||||
<Ref id="sslContextFactory"/>
|
||||
</Arg>
|
||||
<!-- Uncomment to enable to apply ReferrerPushStrategy for spdy/3
|
||||
if you want to support it in both spdy/2 and spdy/3, just replace the
|
||||
value in the first map entry.
|
||||
<Arg name="pushStrategies">
|
||||
<Map>
|
||||
<Entry>
|
||||
<Item type="short">2</Item>
|
||||
<Item><New class="org.eclipse.jetty.spdy.http.PushStrategy$None" /></Item>
|
||||
</Entry>
|
||||
<Entry>
|
||||
<Item type="short">3</Item>
|
||||
<Item><Ref id="pushStrategy" /></Item>
|
||||
</Entry>
|
||||
</Map>
|
||||
</Arg>
|
||||
-->
|
||||
<Set name="Port">8443</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
<!-- =========================================================== -->
|
||||
<!-- Set connectors -->
|
||||
<!-- =========================================================== -->
|
||||
<Call id="sslConnector" name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.SelectChannelConnector">
|
||||
<Arg name="server"><Ref id="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.SslConnectionFactory">
|
||||
<Arg name="next">npn</Arg>
|
||||
<Arg name="sslContextFactory"><Ref id="sslContextFactory"/></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.NPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String">
|
||||
<Item>spdy/3</Item>
|
||||
<Item>spdy/2</Item>
|
||||
<Item>http/1.1</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">http/1.1</Set>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">3</Arg>
|
||||
<Arg name="config"><Ref id="httpConfig"/></Arg>
|
||||
<!-- <Arg name="pushStrategy"><Ref id="pushStrategy"/></Arg> -->
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">2</Arg>
|
||||
<Arg name="config"><Ref id="httpConfig"/></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>
|
||||
</Call>
|
||||
|
||||
|
||||
|
||||
</Configure>
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.jetty.spdy.api.StreamFrameListener;
|
|||
import org.eclipse.jetty.spdy.api.SynInfo;
|
||||
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
||||
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.Logger;
|
||||
|
||||
|
@ -42,7 +43,17 @@ public class HTTPSPDYServerConnectionFactory extends SPDYServerConnectionFactory
|
|||
private final PushStrategy pushStrategy;
|
||||
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);
|
||||
this.pushStrategy = pushStrategy;
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ProtocolNegotiationTest
|
|||
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setTrustStore("src/test/resources/truststore.jks");
|
||||
sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
sslContextFactory.setProtocol("TLSv1");
|
||||
sslContextFactory.setIncludeProtocols("TLSv1");
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.jetty.io.EndPoint;
|
|||
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
|
||||
import org.eclipse.jetty.server.AbstractConnectionFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
|
||||
public class NPNServerConnectionFactory extends AbstractConnectionFactory
|
||||
{
|
||||
|
@ -38,7 +39,7 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
|
|||
/**
|
||||
* @param protocols List of supported protocols in priority order
|
||||
*/
|
||||
public NPNServerConnectionFactory(String... protocols)
|
||||
public NPNServerConnectionFactory(@Name("protocols")String... protocols)
|
||||
{
|
||||
super("npn");
|
||||
_protocols=Arrays.asList(protocols);
|
||||
|
@ -80,5 +81,10 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
|
|||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public abstract class AbstractTest
|
|||
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
sslContextFactory.setTrustStore("src/test/resources/truststore.jks");
|
||||
sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
|
||||
sslContextFactory.setTrustStorePassword("storepwd");
|
||||
sslContextFactory.setProtocol("TLSv1");
|
||||
sslContextFactory.setIncludeProtocols("TLSv1");
|
||||
|
|
|
@ -516,7 +516,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
* @param trustStorePath
|
||||
* The file name or URL of the trust store location
|
||||
*/
|
||||
public void setTrustStore(String trustStorePath)
|
||||
public void setTrustStorePath(String trustStorePath)
|
||||
{
|
||||
checkNotStarted();
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ public class SslContextFactoryTest
|
|||
{
|
||||
SslContextFactory.LOG.info("EXPECT SslContextFactory@????????(null,/foo): java.lang.IllegalStateException: SSL doesn't have a valid keystore...");
|
||||
((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true);
|
||||
cf.setTrustStore("/foo");
|
||||
cf.setTrustStorePath("/foo");
|
||||
cf.start();
|
||||
Assert.fail();
|
||||
}
|
||||
|
|
|
@ -754,9 +754,9 @@ public class XmlConfiguration
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("XML new " + oClass);
|
||||
|
||||
Object n;
|
||||
try
|
||||
{
|
||||
Object n;
|
||||
if (namedArgMap.size() > 0)
|
||||
{
|
||||
LOG.debug("using named mapping");
|
||||
|
@ -767,14 +767,13 @@ public class XmlConfiguration
|
|||
LOG.debug("using normal mapping");
|
||||
n = TypeUtil.construct(oClass, arguments.toArray());
|
||||
}
|
||||
|
||||
configure(n,node,argIndex);
|
||||
return n;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new IllegalStateException("No suitable constructor: " + node + " on " + obj);
|
||||
}
|
||||
configure(n,node,argIndex);
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -97,7 +97,7 @@ public class TestServer
|
|||
cf.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
|
||||
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
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");
|
||||
server.addConnector(ssl_connector);
|
||||
|
||||
|
|
Loading…
Reference in New Issue