Hello - Working with the latest Jetty 9.0.4 and trying to get SPDY
support working. I have been successful with WebSockets handlers working
with this same code, but when I render a test page to test for SPDY, it
is not upgrading the connection. So I stripped out all the WebSocket
config and am just trying to get SPDY working by itself - here is the
code for that:
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(500);
NextProtoNego.debug = true;
server = new Server(threadPool);
server.manage(threadPool);
server.setDumpAfterStart(false);
server.setDumpBeforeStop(false);
// Common HTTP configuration
HttpConfiguration config = new HttpConfiguration();
config.setSecurePort(8443);
config.addCustomizer(new ForwardedRequestCustomizer());
config.addCustomizer(new SecureRequestCustomizer());
config.setSendServerVersion(true);
// config.setOutputBufferSize(32768);
config.setSecureScheme("https");
// Http Connector
HttpConnectionFactory http = new
HttpConnectionFactory(config);
ServerConnector httpConnector = new
ServerConnector(server,http);
httpConnector.setPort(8081);
httpConnector.setIdleTimeout(10000);
httpConnector.setHost("127.0.0.1");
server.addConnector(httpConnector);
// SSL configurations
SslContextFactory sslContextFactory = new
SslContextFactory();
sslContextFactory.setKeyStorePath("keystore");
sslContextFactory.setTrustStorePath("keystore");
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setProtocol("TLSv1");
sslContextFactory.setIncludeProtocols("TLSv1");
sslContextFactory.setEndpointIdentificationAlgorithm("");
sslContextFactory.setExcludeCipherSuites(
"SSL_RSA_WITH_DES_CBC_SHA",
"SSL_DHE_RSA_WITH_DES_CBC_SHA",
"SSL_DHE_DSS_WITH_DES_CBC_SHA",
"SSL_RSA_EXPORT_WITH_RC4_40_MD5",
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
// Spdy Connector
SPDYServerConnectionFactory.checkNPNAvailable();
PushStrategy push = new ReferrerPushStrategy();
HTTPSPDYServerConnectionFactory spdy2 = new
HTTPSPDYServerConnectionFactory(2,config,push);
spdy2.setInputBufferSize(8192);
spdy2.setInitialWindowSize(32768);
HTTPSPDYServerConnectionFactory spdy3 = new
HTTPSPDYServerConnectionFactory(3,config,push);
spdy3.setInputBufferSize(8192);
NPNServerConnectionFactory npn = new
NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getProtocol());
npn.setDefaultProtocol(http.getProtocol());
npn.setInputBufferSize(1024);
SslConnectionFactory ssl = new
SslConnectionFactory(sslContextFactory,"http/1.1");
ServerConnector spdyConnector = new
ServerConnector(server,ssl,npn,spdy3,spdy2,http);
spdyConnector.setPort(8443);
spdyConnector.setHost("127.0.0.1");
server.addConnector(spdyConnector);
HandlerCollection handlers = new HandlerCollection();
ContextHandlerCollection contexts = new
ContextHandlerCollection();
RequestLogHandler requestLogHandler = new
RequestLogHandler();
context = new ContextHandler(server,"/");
context.setContextPath("/");
context.setResourceBase("standalone/deployments/onslyde-hosted.war/");
context.setHandler(new ResourceHandler());
contexts.addHandler(context);
handlers.setHandlers(new Handler[] { contexts, new
DefaultHandler(), requestLogHandler });
StatisticsHandler stats = new StatisticsHandler();
stats.setHandler(handlers);
server.setHandler(stats);
DeploymentManager deployer = new DeploymentManager();
deployer.setContexts(contexts);
server.addBean(deployer);
HashLoginService login = new HashLoginService();
login.setName("Test Realm");
login.setConfig("etc/realm.properties");
server.addBean(login);
NCSARequestLog requestLog = new AsyncNCSARequestLog();
requestLog.setFilename("jetty_logs/jetty-yyyy_mm_dd.log");
requestLog.setExtended(true);
requestLogHandler.setRequestLog(requestLog);
server.start();
server.dumpStdErr();
The source is from SPDYServer in the embedded exaamples.
I am using the same keystore from the jetty source code, and I
configured /etc/hosts to point to "jetty.mortbay.org
<http://jetty.mortbay.org>". The certificate is trusted and everything
matches up in my browser. I'm able to pull up a test page with one image
and one script file using https://jetty.mortbay.org:8443/spdy.html - but
I am not seeing any spdy connections in
chrome's chrome://net-internals/#events&q=type:SPDY_SESSION%20is:active
utility. I only get SSL connections.
Here is my console log from the server which is embedding Jetty:
15:48:23,767 WARN
[org.eclipse.jetty.spdy.server.NPNServerConnectionFactory] (MSC
service thread 1-9) NextProtoNego not from bootloader classloader:
ModuleClassLoader for Module "deployment.onslyde-hosted.war:main" from
Service Module Loader
15:48:23,791 INFO [org.eclipse.jetty.server.Server] (MSC service thread
1-9) jetty-9.0.4.v20130625
15:48:23,806 INFO [org.eclipse.jetty.server.handler.ContextHandler]
(MSC service thread 1-9) Started
o.e.j.s.h.ContextHandler@2551701{/,file:/Users/wesleyhales/dev/onslyde/target/onslyde-hosted/,AVAILABLE}
15:48:23,816 INFO [org.eclipse.jetty.server.ServerConnector] (MSC
service thread 1-9) Started
ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081 <http://127.0.0.1:8081>}
15:48:23,925 INFO [org.eclipse.jetty.server.ServerConnector] (MSC
service thread 1-9) Started
ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>}
I know it says "NextProtoNego not from bootloader classloader" in the
log, but I am starting a server which then starts jetty internally. The
NPN jar is included on the parent server start and this is the only way
I know how to get Jetty access to this jar.
-Xbootclasspath/p:$SERVER_HOME/npn-boot-1.1.0.v20120525.jar
I tried System classloading it before server start, but had no success.
Is there any way to do this correctly on an embedded Jetty server using
server.start()?
Here's my Jetty logs:
========= HTTP/1.1 HTTP/1.1 npn
org.eclipse.jetty.server.Server@2c2b0c9a - STARTED
+= qtp564322865{STARTED,8<=25<=200,i=1,q=0} - STARTED
| +- 104 qtp564322865-104-selector-0 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 105 qtp564322865-105-selector-1 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 106 qtp564322865-106-selector-2 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 107 qtp564322865-107-selector-3 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 108 qtp564322865-108-selector-4 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 109 qtp564322865-109-selector-5 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 110 qtp564322865-110-selector-6 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 111 qtp564322865-111-selector-7 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 113
qtp564322865-113-acceptor-0-ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081
<http://127.0.0.1:8081>} RUNNABLE @
sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
| +- 114
qtp564322865-114-acceptor-1-ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081
<http://127.0.0.1:8081>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 115
qtp564322865-115-acceptor-2-ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081
<http://127.0.0.1:8081>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 116
qtp564322865-116-acceptor-3-ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081
<http://127.0.0.1:8081>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 118 qtp564322865-118-selector-0 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 119 qtp564322865-119-selector-1 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 120 qtp564322865-120-selector-2 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 121 qtp564322865-121-selector-3 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 122 qtp564322865-122-selector-4 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 123 qtp564322865-123-selector-5 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 124 qtp564322865-124-selector-6 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 125 qtp564322865-125-selector-7 RUNNABLE @
sun.nio.ch.PollArrayWrapper.poll0(Native Method)
| +- 126
qtp564322865-126-acceptor-0-ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>} RUNNABLE @
sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
| +- 127
qtp564322865-127-acceptor-1-ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 128
qtp564322865-128-acceptor-2-ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 129
qtp564322865-129-acceptor-3-ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>} BLOCKED @
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:210)
| +- 130 qtp564322865-130 TIMED_WAITING @
sun.misc.Unsafe.park(Native Method) IDLE
+= ServerConnector@35c070cd{HTTP/1.1}{127.0.0.1:8081
<http://127.0.0.1:8081>} - STARTED
| +~ org.eclipse.jetty.server.Server@2c2b0c9a - STARTED
| +~ qtp564322865{STARTED,8<=25<=200,i=1,q=0} - STARTED
| +=
org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@2525dc6a - STARTED
| +- org.eclipse.jetty.io.ArrayByteBufferPool@12849767
| += HttpConnectionFactory@3eeff4b0{HTTP/1.1} - STARTED
| | +-
HttpConfiguration@7ba96f17{32768,8192/8192,https://:8443,[ForwardedRequestCustomizer@30bc8e6e,
SecureRequestCustomizer@2b2af0c1]}
| +=
org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@1024250b
- STARTED
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@34fbfd74 keys=0
selected=0 id=0
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@42aaaa58 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@52959999 keys=0
selected=0 id=1
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@6ec7b34a keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@78cbf817 keys=0
selected=0 id=2
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@434c104c keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@36c21018 keys=0
selected=0 id=3
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@77d7e3ce keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@7ead26d9 keys=0
selected=0 id=4
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@3bb65db1 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@41c12e17 keys=0
selected=0 id=5
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@4bd7c30b keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@42462e13 keys=0
selected=0 id=6
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@161a8e7e keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@2980fd88 keys=0
selected=0 id=7
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | +- sun.nio.ch.PollSelectorImpl@344294e4 keys=0
| +- sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:8081
<http://127.0.0.1:8081>]
+= ServerConnector@694f85a7{SSL-http/1.1}{127.0.0.1:8443
<http://127.0.0.1:8443>} - STARTED
| +~ org.eclipse.jetty.server.Server@2c2b0c9a - STARTED
| +~ qtp564322865{STARTED,8<=25<=200,i=1,q=0} - STARTED
| +=
org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@61106114 - STARTED
| +- org.eclipse.jetty.io.ArrayByteBufferPool@7f3d1f89
| += SslConnectionFactory@5e19ca2{SSL-http/1.1} - STARTED
| | += SslContextFactory@1ef252b2(keystore,keystore) - STARTED
| += NPNServerConnectionFactory@371333fd{npn,HTTP/1.1,[spdy/3,
spdy/2, HTTP/1.1]} - STARTED
| += HTTPSPDYServerConnectionFactory@4dba434a{spdy/3} - STARTED
| | +-
HttpConfiguration@7ba96f17{32768,8192/8192,https://:8443,[ForwardedRequestCustomizer@30bc8e6e,
SecureRequestCustomizer@2b2af0c1]}
| += HTTPSPDYServerConnectionFactory@7f97d723{spdy/2} - STARTED
| | +-
HttpConfiguration@7ba96f17{32768,8192/8192,https://:8443,[ForwardedRequestCustomizer@30bc8e6e,
SecureRequestCustomizer@2b2af0c1]}
| +~ HttpConnectionFactory@3eeff4b0{HTTP/1.1} - STARTED
| +=
org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@49ad7c46
- STARTED
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@1cb9fd74 keys=0
selected=0 id=0
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@13927e1e keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@7695ed9b keys=0
selected=0 id=1
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@14222914 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@4eb6ea5f keys=0
selected=0 id=2
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@3e7a21d keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@5c441feb keys=0
selected=0 id=3
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@31e57021 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@4e24a01e keys=0
selected=0 id=4
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@491d7b67 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@2e90ccb1 keys=0
selected=0 id=5
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@17fad974 keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@55da5af8 keys=0
selected=0 id=6
| | | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | | +- sun.nio.ch.PollSelectorImpl@435cb28f keys=0
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector@7aceecd5 keys=0
selected=0 id=7
| | +-
org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:444)
| | +- sun.nio.ch.PollSelectorImpl@299447da keys=0
| +- sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:8443
<http://127.0.0.1:8443>]
+= org.eclipse.jetty.server.handler.StatisticsHandler@45f94e89 - STARTED
| += org.eclipse.jetty.server.handler.HandlerCollection@72932842 -
STARTED
| +=
org.eclipse.jetty.server.handler.ContextHandlerCollection@1b383fd2 - STARTED
| | +=
o.e.j.s.h.ContextHandler@2551701{/,file:/Users/wesleyhales/dev/onslyde/target/onslyde-hosted/,AVAILABLE}
- STARTED
| | +=
org.eclipse.jetty.server.handler.ResourceHandler@9e601f4 - STARTED
| | |
| | +> No ClassLoader
| += org.eclipse.jetty.server.handler.DefaultHandler@5b8a3f3f -
STARTED
| += org.eclipse.jetty.server.handler.RequestLogHandler@513e700c
- STARTED
| += org.eclipse.jetty.server.AsyncNCSARequestLog@2f1681a5 -
STARTED
+= org.eclipse.jetty.deploy.DeploymentManager@5a2e4d7f - STARTED
+= HashLoginService[Test Realm] - STARTED
Can anyone tell me why the plain HTML page will not be served as SDPY
enabled? only ssl?
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users