/** * Flush the buffer by looping until the <code>ByteBuffer</code> is empty * using <code>SSLOutputBuffer</code> * @param bb the ByteBuffer to write. */ @Override public void flushChannel(ByteBuffer bb) throws IOException{ SSLOutputWriter.flushChannel(socketChannel, bb, outputBB, sslEngine); }
/** * Flush the buffer by looping until the <code>ByteBuffer</code> is empty * using <code>SSLOutputBuffer</code> * @param bb the ByteBuffer to write. */ @Override public void flushChannel(ByteBuffer bb) throws IOException{ SSLOutputWriter.flushChannel(socketChannel, bb, outputBB, sslEngine); }
@Override protected void sendCache(SocketChannel socketChannel, FileCacheEntry entry, boolean keepAlive) throws IOException{ SSLOutputWriter.flushChannel(socketChannel, entry.headerBuffer.slice()); ByteBuffer keepAliveBuf = keepAlive ? connectionKaBB.slice(): connectionCloseBB.slice(); SSLOutputWriter.flushChannel(socketChannel, keepAliveBuf); SSLOutputWriter.flushChannel(socketChannel, entry.bb.slice()); } };
/** * Redirect a secure request (https) to http or https. * @param protocolInfo the ProtocolInfo that contains the information about * the current protocol state. * @param byteBuffer the bytes response. */ private final void redirectSSL(ProtocolInfo protocolInfo, String httpHeaders) throws IOException{ SSLOutputWriter.flushChannel(protocolInfo.socketChannel, SC_FOUND.slice(), protocolInfo.outputBB, protocolInfo.sslEngine); SSLOutputWriter.flushChannel(protocolInfo.socketChannel, ByteBuffer.wrap((httpHeaders + protocolInfo.requestURI + headers) .getBytes()), protocolInfo.outputBB, protocolInfo.sslEngine); }
/** * Encrypt the response and flush it using <code>OutputWriter</code> */ public static void flushChannel(SocketChannel socketChannel, ByteBuffer bb) throws IOException{ SSLWorkerThread workerThread = (SSLWorkerThread)Thread.currentThread(); SSLEngine sslEngine = workerThread.getSSLEngine(); ByteBuffer outputBB = workerThread.getOutputBB(); flushChannel(socketChannel,bb,outputBB,sslEngine); }