@Override public void onClosed(Closeable closeable, CloseType type) throws IOException { if (isGracefullyFinishResponseOnClose()) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final FilterChain fc = (FilterChain) connection.getProcessor(); fc.fireEventUpstream(connection, new GracefulCloseEvent(HttpTransactionContext.this), null); } else if (CloseType.REMOTELY.equals(type)) { abort(AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION); } else { try { closeable.assertOpen(); } catch (IOException ioe) { // unwrap the exception as it was wrapped by assertOpen. abort(ioe.getCause()); } } } };
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == GracefulCloseEvent.class) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final GracefulCloseEvent closeEvent = (GracefulCloseEvent) event; final HttpResponsePacket response = closeEvent.getHttpTxContext().responsePacket; response.getProcessingState().getHttpContext().attach(ctx); onHttpPacketParsed(response, ctx); return ctx.getStopAction(); } return ctx.getInvokeAction(); }
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == GracefulCloseEvent.class) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final GracefulCloseEvent closeEvent = (GracefulCloseEvent) event; final HttpResponsePacket response = closeEvent.getHttpTxContext().responsePacket; response.getProcessingState().getHttpContext().attach(ctx); onHttpPacketParsed(response, ctx); return ctx.getStopAction(); } return ctx.getInvokeAction(); }
@Override public void onClosed(Closeable closeable, CloseType type) throws IOException { if (isGracefullyFinishResponseOnClose() || isKeepAliveDisabled()) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final FilterChain fc = (FilterChain) connection.getProcessor(); fc.fireEventUpstream(connection, new GracefulCloseEvent(HttpTransactionContext.this), null); } else if (CloseType.REMOTELY.equals(type)) { abort(AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION); } else { try { closeable.assertOpen(); } catch (IOException ioe) { // unwrap the exception as it was wrapped by assertOpen. abort(ioe.getCause()); } } } };
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == GracefulCloseEvent.class) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final GracefulCloseEvent closeEvent = (GracefulCloseEvent) event; final HttpResponsePacket response = closeEvent.getHttpTxContext().responsePacket; response.getProcessingState().getHttpContext().attach(ctx); onHttpPacketParsed(response, ctx); return ctx.getStopAction(); } return ctx.getInvokeAction(); }
@Override public void onClosed(Closeable closeable, CloseType type) throws IOException { if (isGracefullyFinishResponseOnClose() || isKeepAliveDisabled()) { // Connection was closed. // This event is fired only for responses, which don't have // associated transfer-encoding or content-length. // We have to complete such a request-response processing gracefully. final FilterChain fc = (FilterChain) connection.getProcessor(); fc.fireEventUpstream(connection, new GracefulCloseEvent(HttpTransactionContext.this), null); } else if (CloseType.REMOTELY.equals(type)) { abort(AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION); } else { try { closeable.assertOpen(); } catch (IOException ioe) { // unwrap the exception as it was wrapped by assertOpen. abort(ioe.getCause()); } } } };