@Override public String getProtocol() { return connectionFactory.getProtocol(); }
@Override public Connection newConnection(Connector connector, EndPoint endPoint) { final Connection connection = connectionFactory.newConnection(connector, endPoint); connection.addListener(new Connection.Listener() { @Nullable private Timer.Context context; @Override public void onOpened(Connection connection) { this.context = timer.time(); } @Override public void onClosed(Connection connection) { requireNonNull(context).stop(); } }); return connection; } }
@Override public List<String> getProtocols() { return connectionFactory.getProtocols(); }
for (String key:factory.getProtocols()) if (old!=null) if (old.getProtocol().equals(_defaultProtocol)) _defaultProtocol=null; to_remove.add(old); _defaultProtocol=factory.getProtocol(); if (LOG.isDebugEnabled()) LOG.debug("{} added {}", this, factory);
for (String key:factory.getProtocols()) if (old!=null) if (old.getProtocol().equals(_defaultProtocol)) _defaultProtocol=null; to_remove.add(old); _defaultProtocol=factory.getProtocol(); if (LOG.isDebugEnabled()) LOG.debug("{} added {}", this, factory);
@Override public String getProtocol() { return connectionFactory.getProtocol(); }
@Override public Connection newConnection(Connector connector, EndPoint endPoint) { final Connection connection = connectionFactory.newConnection(connector, endPoint); connection.addListener( new Connection.Listener() { @Override public void onOpened(Connection connection) { activeConns.incrementAndGet(); } @Override public void onClosed(Connection connection) { activeConns.decrementAndGet(); } } ); return connection; } }
@Override public List<String> getProtocols() { return connectionFactory.getProtocols(); }
private URI getServerUri(ServerConnector connector) throws URISyntaxException { String scheme = "http"; for (ConnectionFactory connectFactory : connector .getConnectionFactories()) { if (connectFactory.getProtocol().startsWith("SSL-http")) { scheme = "https"; } } String host = connector.getHost(); if (host == null) { try{ host = InetAddress.getLocalHost().getHostName(); }catch(Exception ex){} } if (host == null){ host = "localhost"; } int myport = connector.getLocalPort(); serverURI = new URI(String.format("%s://%s:%d", scheme, host, myport)); System.out.println(new Date() + " Server URI: " + serverURI + this.contextPath); return serverURI; }
@Override public Connection newConnection(SocketChannel channel, EndPoint endpoint, Object attachment) throws IOException { return getDefaultConnectionFactory().newConnection(ServerConnector.this, endpoint); }
private static Server startHttp1() throws Exception { final Server server = new Server(0); final ServletHandler handler = new ServletHandler(); handler.addServletWithMapping(newServletHolder(thriftServlet), TSERVLET_PATH); handler.addServletWithMapping(newServletHolder(rootServlet), "/"); handler.addFilterWithMapping(new FilterHolder(new ConnectionCloseFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); server.setHandler(handler); for (Connector c : server.getConnectors()) { for (ConnectionFactory f : c.getConnectionFactories()) { for (String p : f.getProtocols()) { if (p.startsWith("h2c")) { fail("Attempted to create a Jetty server without HTTP/2 support, but failed: " + f.getProtocols()); } } } } server.start(); return server; }
@Override public String getProtocol() { return connectionFactory.getProtocol(); }
@Override public Connection newConnection(SocketChannel channel, EndPoint endpoint, Object attachment) throws IOException { return getDefaultConnectionFactory().newConnection(ServerConnector.this, endpoint); }
@Override public List<String> getProtocols() { return connectionFactory.getProtocols(); } }
@Override public String getProtocol() { return connectionFactory.getProtocol(); }
@Override public Connection newConnection(SocketChannel channel, EndPoint endpoint, Object attachment) throws IOException { return getDefaultConnectionFactory().newConnection(ServerConnector.this, endpoint); }
@Override public List<String> getProtocols() { return connectionFactory.getProtocols(); }
@Override public String getProtocol() { return _wrappedConnectionFactory.getProtocol(); }
@Override public Connection newConnection(SelectableChannel channel, EndPoint endpoint, Object attachment) throws IOException { return getDefaultConnectionFactory().newConnection(ServerConnector.this, endpoint); }
@Override public List<String> getProtocols() { return connectionFactory.getProtocols(); }