@Override public void onFlushed(long bytes) throws IOException { // Unfortunately cannot distinguish between header and content // bytes, and for content bytes whether they are chunked or not. _channel.getResponse().getHttpOutput().onFlushed(bytes); }
/** * If the associated response has the Expect header set to 100 Continue, * then accessing the input stream indicates that the handler/servlet * is ready for the request body and thus a 100 Continue response is sent. * * @throws IOException if the InputStream cannot be created */ @Override public void continue100(int available) throws IOException { // If the client is expecting 100 CONTINUE, then send it now. // TODO: consider using an AtomicBoolean ? if (isExpecting100Continue()) { _expect100Continue = false; // is content missing? if (available == 0) { if (getResponse().isCommitted()) throw new IOException("Committed before 100 Continues"); boolean committed = sendResponse(HttpGenerator.CONTINUE_100_INFO, null, false); if (!committed) throw new IOException("Concurrent commit while trying to send 100-Continue"); } } }
/** * If the associated response has the Expect header set to 100 Continue, * then accessing the input stream indicates that the handler/servlet * is ready for the request body and thus a 100 Continue response is sent. * * @throws IOException if the InputStream cannot be created */ @Override public void continue100(int available) throws IOException { // If the client is expecting 100 CONTINUE, then send it now. // TODO: consider using an AtomicBoolean ? if (isExpecting100Continue()) { _expect100Continue = false; // is content missing? if (available == 0) { if (getResponse().isCommitted()) throw new IOException("Committed before 100 Continues"); boolean committed = sendResponse(HttpGenerator.CONTINUE_100_INFO, null, false); if (!committed) throw new IOException("Concurrent commit while trying to send 100-Continue"); } } }
persistent = HttpMethod.CONNECT.is(_metadata.getMethod()); if (persistent) getResponse().getHttpFields().add(HttpHeader.CONNECTION, HttpHeaderValue.KEEP_ALIVE); persistent = HttpMethod.CONNECT.is(_metadata.getMethod()); if (!persistent) getResponse().getHttpFields().add(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE);
persistent = HttpMethod.CONNECT.is(_metadata.getMethod()); if (persistent) getResponse().getHttpFields().add(HttpHeader.CONNECTION, HttpHeaderValue.KEEP_ALIVE); persistent = HttpMethod.CONNECT.is(_metadata.getMethod()); if (!persistent) getResponse().getHttpFields().add(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE);
if (_channel.getResponse().getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101)
if (_channel.getResponse().getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101)
LOG.debug("Upgrade from {} to {}", getEndPoint().getConnection(),upgrade_connection); getRequest().setAttribute(HttpConnection.UPGRADE_CONNECTION_ATTRIBUTE,upgrade_connection); getResponse().setStatus(101); getHttpTransport().onCompleted(); return true;
LOG.debug("Upgrade from {} to {}", getEndPoint().getConnection(), upgrade_connection); getRequest().setAttribute(HttpConnection.UPGRADE_CONNECTION_ATTRIBUTE, upgrade_connection); getResponse().setStatus(101); getHttpTransport().onCompleted(); return true;