@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx);
HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx);
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (isResponseHeaders(msg)) { // Update the request count attribute for this channel. requestCount++; if (isConnectionExpired(ctx)) { // Flag this channel to be closed after response is written. HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); // with close of configured type. ConnectionCloseType.setForChannel(ctx.channel(), connectionCloseType); } } super.write(ctx, msg, promise); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
public void set(ChannelHandlerContext ctx) { set(ctx.channel()); }
public boolean get(ChannelHandlerContext ctx) { return get(ctx.channel()); } }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
protected boolean isAlreadyClosing(Channel parentChannel) { // If already closing, then just return. // This will happen because close() is called a 2nd time after sending the goaway frame. if (HttpChannelFlags.CLOSING.get(parentChannel)) { return true; } else { HttpChannelFlags.CLOSING.set(parentChannel); return false; } }
HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx);
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (isResponseHeaders(msg)) { // Update the request count attribute for this channel. requestCount++; if (isConnectionExpired(ctx)) { // Flag this channel to be closed after response is written. HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); // with close of configured type. ConnectionCloseType.setForChannel(ctx.channel(), connectionCloseType); } } super.write(ctx, msg, promise); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (isResponseHeaders(msg)) { // Update the request count attribute for this channel. requestCount++; if (isConnectionExpired(ctx)) { // Flag this channel to be closed after response is written. HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); // with close of configured type. ConnectionCloseType.setForChannel(ctx.channel(), connectionCloseType); } } super.write(ctx, msg, promise); }
public void set(ChannelHandlerContext ctx) { set(ctx.channel()); }
public void set(ChannelHandlerContext ctx) { set(ctx.channel()); }
public boolean get(ChannelHandlerContext ctx) { return get(ctx.channel()); } }