What is the alternative class of SelectChannelConnector for jetty 9 and above version? Also what is the use of SelectChannelConnector class? And also what is the use of connector classes in jetty/servlet architechture?
Can we use ServerConnector or NetworkTrafficSelectChannelConnector (deprecated in jetty 9.x) class instead of SelectChannelConnector?Answer1:
Connector in jetty terms is the component that binds to a port, accepts incoming connections, negotiates the protocols (in case of SSL/TLS/ALPN and things like HTTP/2), and hands off the raw endpoint to the appropriate jetty internal component to process the request.
Gone are the days of listening on port 8080 and answering only in HTTP/1.x
Now you can listen on port 8080, and the incoming connection negotiates SSL > TLS > > ALPN > HTTP/2 (native) > HTTP/1.1 > HTTP/2 (h2c upgrate) etc. Essentially picking the appropriate connection setup based on what both the client and the server can handle.
There is only
ServerConnector left, and it has many configuration options to tell it what you want it to support.
See the embedded examples or the documentation to understand how to configure it.