/** * This is used to collect the data from a <code>Channel</code> * which is used to compose the entity. If at any stage there * are no ready bytes on the socket the selector provided can be * used to queue the collector until such time as the socket is * ready to read. Also, should the entity have completed reading * all required content it is handed to the selector as ready, * which processes the entity as a new client HTTP request. * * @param selector this is the selector used to queue this */ public void collect(Selector selector) throws IOException { while(cursor.isReady()) { if(entity.isFinished()) { break; } else { timer.set(); entity.consume(cursor); } } if(cursor.isOpen()) { if(entity.isFinished()) { trace.trace(REQUEST_READY); selector.ready(this); } else { trace.trace(READ_WAIT); selector.select(this); } } }
/** * This is used to collect the data from a <code>Channel</code> * which is used to compose the entity. If at any stage there * are no ready bytes on the socket the controller provided can * be used to queue the collector until such time as the socket * is ready to read. Also, should the entity have completed reading * all required content it is handed to the controller as ready, * which processes the entity as a new client HTTP request. * * @param controller this is the controller used to queue this */ public void collect(Controller controller) throws IOException { while(cursor.isReady()) { if(entity.isFinished()) { break; } else { timer.set(); entity.consume(cursor); } } if(cursor.isOpen()) { if(entity.isFinished()) { trace.trace(REQUEST_READY); controller.ready(this); } else { trace.trace(READ_WAIT); controller.select(this); } } }
/** * This is used to collect the data from a <code>Channel</code> * which is used to compose the entity. If at any stage there * are no ready bytes on the socket the controller provided can * be used to queue the collector until such time as the socket * is ready to read. Also, should the entity have completed reading * all required content it is handed to the controller as ready, * which processes the entity as a new client HTTP request. * * @param controller this is the controller used to queue this */ public void collect(Controller controller) throws IOException { while(cursor.isReady()) { if(entity.isFinished()) { break; } else { timer.set(); entity.consume(cursor); } } if(cursor.isOpen()) { if(entity.isFinished()) { trace.trace(REQUEST_READY); controller.ready(this); } else { trace.trace(READ_WAIT); controller.select(this); } } }