Embedding Jetty 9 and customizing Socket Address, Port and ThreadPool? -
i have used jetty 8.1.14 embedded web server in application. trying upgrade version 9.2.10.
with jetty 8, possible specify host address , port using setters in "selectchannelconnector" or "sslselectchannelconnector", , threadpool constructor argument in "server" class.
now, seems 1 can specify 1 or other in "server" class. there constructor variants address and/or port, or threadpool use. can't find variant 3 arguments.
how can specify parameters jetty 9? have tried:
string bindaddress = "myvalue"; int port = 12345; server s = new server(new inetsocketaddress(bindadress, port));
and
threadpool t = myhighlycustomizedthreadpool(); server s = new server(t);
use serverconnector
setting listen ports, setting listen host addresses, setting idle timeouts, , setting default protocols. once started, same connector can used determine actual listening port (if using dynamically assigned ports), actual listen hosts (if using dynamic host addresses), etc ...
use httpconfiguration
setting buffers, secure identification (used secure redirects), tweaking headers, powered by, server version announcement, etc..
use connectionfactory
implementations control how progression of protocol selection should work accepted incoming connection. (yes, thing important in today's web infrastructure)
for basic example of http/1.1 , ssl+http/1.1 (aka https) see manyconnectors.java
embedded example
for example of connectionfactory
behavior spdy, see spdyconnector.java
example (note: spdy has been deprecated in favor of http/2 in jetty 9.3.x)
for example of connectionfactory
behavior tls + alpn + http/2, see http2server.java
example (note: you'll need jetty 9.3.x this)
Comments
Post a Comment