comparison src/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java @ 952:669769bcdf5c

simplify AsyncEndPoint
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 12 Oct 2016 19:47:45 -0600
parents d1c302afeeb6
children d82eb99e8df6
comparison
equal deleted inserted replaced
951:e542a9cc75ef 952:669769bcdf5c
33 import org.eclipse.jetty.io.BuffersFactory; 33 import org.eclipse.jetty.io.BuffersFactory;
34 import org.eclipse.jetty.io.EndPoint; 34 import org.eclipse.jetty.io.EndPoint;
35 import org.eclipse.jetty.io.RuntimeIOException; 35 import org.eclipse.jetty.io.RuntimeIOException;
36 import org.eclipse.jetty.io.nio.AsyncConnection; 36 import org.eclipse.jetty.io.nio.AsyncConnection;
37 import org.eclipse.jetty.io.nio.SslConnection; 37 import org.eclipse.jetty.io.nio.SslConnection;
38 import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
38 import org.eclipse.jetty.server.Request; 39 import org.eclipse.jetty.server.Request;
39 import org.eclipse.jetty.server.Server; 40 import org.eclipse.jetty.server.Server;
40 import org.eclipse.jetty.server.nio.SelectChannelConnector; 41 import org.eclipse.jetty.server.nio.SelectChannelConnector;
41 import org.eclipse.jetty.util.component.AggregateLifeCycle; 42 import org.eclipse.jetty.util.component.AggregateLifeCycle;
42 import org.eclipse.jetty.util.ssl.SslContextFactory; 43 import org.eclipse.jetty.util.ssl.SslContextFactory;
528 public boolean isConfidential(Request request) 529 public boolean isConfidential(Request request)
529 { 530 {
530 return true; 531 return true;
531 } 532 }
532 533
533 /* ------------------------------------------------------------------------------- */
534 @Override 534 @Override
535 protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) 535 protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint)
536 { 536 {
537 try 537 try
538 { 538 {
539 SSLEngine engine = createSSLEngine(channel); 539 SSLEngine engine = createSSLEngine(channel);
540 SslConnection connection = newSslConnection(endpoint, engine); 540 SslConnection connection = new SslConnection(engine, endpoint);
541 AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); 541 AsyncConnection delegate = super.newConnection(channel, connection.getSslEndPoint());
542 connection.getSslEndPoint().setConnection(delegate); 542 connection.getSslEndPoint().setConnection(delegate);
543 connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); 543 connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate());
544 return connection; 544 return connection;
545 } 545 }
546 catch (IOException e) 546 catch (IOException e)
547 { 547 {
548 throw new RuntimeIOException(e); 548 throw new RuntimeIOException(e);
549 } 549 }
550 }
551
552 protected AsyncConnection newPlainConnection(SocketChannel channel, AsyncEndPoint endPoint)
553 {
554 return super.newConnection(channel, endPoint);
555 }
556
557 protected SslConnection newSslConnection(AsyncEndPoint endpoint, SSLEngine engine)
558 {
559 return new SslConnection(engine, endpoint);
560 } 550 }
561 551
562 /* ------------------------------------------------------------ */ 552 /* ------------------------------------------------------------ */
563 /** 553 /**
564 * @param channel A channel which if passed is used as to extract remote 554 * @param channel A channel which if passed is used as to extract remote