/** * This method is used to acquire the <code>SocketChannel</code> * for the connection. This allows the server to acquire the input * and output streams with which to communicate. It can also be * used to configure the connection and perform various network * operations that could otherwise not be performed. * * @return this returns the socket used by this HTTP pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * This method is used to get the <code>Map</code> of attributes * by this pipeline. The attributes map is used to maintain details * about the connection. Information such as security credentials * to client details can be placed within the attribute map. * * @return this returns the map of attributes for this pipeline */ public Map getAttributes() { return socket.getAttributes(); }
/** * This is used to acquire the SSL engine used for https. If the * pipeline is connected to an SSL transport this returns an SSL * engine which can be used to establish the secure connection * and send and receive content over that connection. If this is * null then the pipeline represents a normal transport. * * @return the SSL engine used to establish a secure transport */ public SSLEngine getEngine() { return socket.getEngine(); }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * Pass in the connection socket and add the engine to the pipeline * attributes. * * @param socket * the pipeline */ @SuppressWarnings("unchecked") public void process(Socket socket) throws IOException { final Map map = socket.getAttributes(); final SSLEngine engine = socket.getEngine(); final SocketChannel channel = socket.getChannel(); map.put(PROPERTY_ENGINE, engine); map.put(PROPERTY_SOCKET, channel); server.process(socket); }
/** * Constructor for the <code>SocketWriter</code> object. This * is used to wrap the socket in an object that will queue and * coalesce the packets written. It ensures that the packets * that are sent are of a minimum size for performance. * * @param socket this is the pipeline instance this wraps * @param limit this is the threshold for asynchronous buffers */ public SocketWriter(Socket socket, int limit) { this.compacter = new BufferCompacter(limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); }
@SuppressWarnings({"rawtypes", "unchecked"}) public void process(Socket socket) throws IOException { Map atts = socket.getAttributes(); SocketChannel channel = socket.getChannel(); atts.put("fixd-socket", channel); server.process(socket); }
/** * Constructor for the <code>FlushSignaller</code> object. This * will create an operation that is used to flush the buffer * queue to the underlying socket. This ensures that the data * is written to the socket in the queued order. * * @param writer this is the writer to flush the data to * @param socket this is the socket to be flushed */ public FlushSignaller(SocketFlusher writer, Socket socket) { this.trace = socket.getTrace(); this.socket = socket; this.writer = writer; }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>FlushSignaller</code> object. This * will create an operation that is used to flush the buffer * queue to the underlying socket. This ensures that the data * is written to the socket in the queued order. * * @param writer this is the writer to flush the data to * @param socket this is the socket to be flushed */ public FlushSignaller(SocketFlusher writer, Socket socket) { this.trace = socket.getTrace(); this.socket = socket; this.writer = writer; }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * This is used to acquire the SSL engine used for https. If the * pipeline is connected to an SSL transport this returns an SSL * engine which can be used to establish the secure connection * and send and receive content over that connection. If this is * null then the pipeline represents a normal transport. * * @return the SSL engine used to establish a secure transport */ public SSLEngine getEngine() { return socket.getEngine(); }
/** * This method is used to acquire the <code>SocketChannel</code> * for the connection. This allows the server to acquire the input * and output streams with which to communicate. It can also be * used to configure the connection and perform various network * operations that could otherwise not be performed. * * @return this returns the socket used by this HTTP pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * This method is used to get the <code>Map</code> of attributes * by this pipeline. The attributes map is used to maintain details * about the connection. Information such as security credentials * to client details can be placed within the attribute map. * * @return this returns the map of attributes for this pipeline */ public Map getAttributes() { return socket.getAttributes(); }
/** * Constructor for the <code>FlushScheduler</code> object. This * is* used to create a scheduler that will execute the provided * task when the associated socket is write ready. * * @param socket this is the associated socket for the scheduler * @param reactor this is the rector used to schedule execution * @param task this is the task that is executed when writable * @param lock this is the lock used to signal blocking threads */ public FlushScheduler(Socket socket, Reactor reactor, Operation task, Object lock) { this.trace = socket.getTrace(); this.reactor = reactor; this.task = task; this.lock = lock; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param buffer this is the size of the output buffer to use * @param threshold this is the maximum size of the output buffer */ public SocketTransport(Socket socket, Reactor reactor, int buffer, int threshold) throws IOException { this.writer = new SocketBufferWriter(socket, reactor, buffer, threshold); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }
/** * This is used to acquire the SSL engine used for https. If the * pipeline is connected to an SSL transport this returns an SSL * engine which can be used to establish the secure connection * and send and receive content over that connection. If this is * null then the pipeline represents a normal transport. * * @return the SSL engine used to establish a secure transport */ public SSLEngine getEngine() { return socket.getEngine(); }
/** * This returns the socket channel for the connected pipeline. It * is this channel that is used to determine if there are bytes * that can be written. When closed this is no longer selectable. * * @return this returns the connected channel for the pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }