public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) { Request jettyRequest = (Request)request; AbstractHttpConnection connection = jettyRequest.getConnection(); Socket socket = (Socket)connection.getEndPoint().getTransport(); if (log.isLoggable(Level.FINE)) log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress()); try { socket.getOutputStream().write(heartbeat); socket.getOutputStream().flush(); return true; } catch (IOException ex) { if (log.isLoggable(Level.FINE)) log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress()); return false; } }
public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) { Request jettyRequest = (Request)request; AbstractHttpConnection connection = jettyRequest.getConnection(); Socket socket = (Socket)connection.getEndPoint().getTransport(); if (log.isLoggable(Level.FINE)) log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress()); try { socket.getOutputStream().write(heartbeat); socket.getOutputStream().flush(); return true; } catch (IOException ex) { if (log.isLoggable(Level.FINE)) log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress()); return false; } }
@Override public Object getTransport() { return _underlying.getTransport(); }
@Override public Object getTransport() { return _endp.getTransport(); }
public Object getTransport() { return _endp.getTransport(); }
@Override public void onOpened(Connection connection) { synchronized (monitor) { connectionsAccepting.remove(connection.getEndPoint().getTransport()); ++connectionOpened; } }
public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) { Request jettyRequest = (Request)request; AbstractHttpConnection connection = jettyRequest.getConnection(); Socket socket = (Socket)connection.getEndPoint().getTransport(); if (log.isLoggable(Level.FINE)) log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress()); try { socket.getOutputStream().write(heartbeat); socket.getOutputStream().flush(); return true; } catch (IOException ex) { if (log.isLoggable(Level.FINE)) log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress()); return false; } }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint, request); endpoint.setMaxIdleTime(_maxIdleTime); configure(((SocketChannel)endpoint.getTransport()).socket()); }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint, request); endpoint.setMaxIdleTime(_maxIdleTime); configure(((SocketChannel)endpoint.getTransport()).socket()); }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint, request); endpoint.setMaxIdleTime(_maxIdleTime); configure(((SocketChannel)endpoint.getTransport()).socket()); }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint, request); endpoint.setMaxIdleTime(_maxIdleTime); configure(((SocketChannel)endpoint.getTransport()).socket()); }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint, request); endpoint.setMaxIdleTime(_maxIdleTime); configure(((SocketChannel)endpoint.getTransport()).socket()); }
@Override public void onOpened(Connection connection) { synchronized (this) { _accepting.remove(connection.getEndPoint().getTransport()); _connections++; if (LOG.isDebugEnabled()) LOG.debug("onOpened ({}+{}) < {} {}",_accepting.size(),_connections,_maxConnections,connection); check(); } }
@Override public void customize(EndPoint endpoint, Request request) throws IOException { if (useKrb) { // Add Kerberos-specific info SSLSocket sslSocket = (SSLSocket) endpoint.getTransport(); Principal remotePrincipal = sslSocket.getSession().getPeerPrincipal(); logIfDebug("Remote principal = " + remotePrincipal); request.setScheme(HttpSchemes.HTTPS); request.setAttribute(REMOTE_PRINCIPAL, remotePrincipal); if (!useCerts) { // Add extra info that would have been added by // super String cipherSuite = sslSocket.getSession().getCipherSuite(); Integer keySize = Integer.valueOf(ServletSSL.deduceKeyLength(cipherSuite)); ; request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite); request.setAttribute("javax.servlet.request.key_size", keySize); } } if (useCerts) super.customize(endpoint, request); }
@Override public void shutdownOutput () { endPoint.shutdownOutput(); } @Override public void close () { endPoint.close(); } @Override public Object getTransport () { return endPoint.getTransport(); } @Override public long getIdleTimeout () { return endPoint.getIdleTimeout(); } @Override public Connection getConnection () { return endPoint.getConnection(); }