write() — netty Function Reference
Architecture documentation for the write() function in HttpServerKeepAliveHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD db8fa580_b26b_c3cb_8f82_220d29371c8b["write()"] 08219795_24b6_3fff_1446_c9792531660c["HttpServerKeepAliveHandler"] db8fa580_b26b_c3cb_8f82_220d29371c8b -->|defined in| 08219795_24b6_3fff_1446_c9792531660c a6374c00_c860_8572_b173_8706804dfb6e["trackResponse()"] db8fa580_b26b_c3cb_8f82_220d29371c8b -->|calls| a6374c00_c860_8572_b173_8706804dfb6e f90d5a22_63aa_2c1b_2232_c23c91dfad4a["isSelfDefinedMessageLength()"] db8fa580_b26b_c3cb_8f82_220d29371c8b -->|calls| f90d5a22_63aa_2c1b_2232_c23c91dfad4a 0fc97c94_f864_244f_c666_b10e832aaf95["shouldKeepAlive()"] db8fa580_b26b_c3cb_8f82_220d29371c8b -->|calls| 0fc97c94_f864_244f_c666_b10e832aaf95 style db8fa580_b26b_c3cb_8f82_220d29371c8b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java lines 67–88
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
// modify message on way out to add headers if needed
if (msg instanceof HttpResponse) {
final HttpResponse response = (HttpResponse) msg;
trackResponse(response);
// Assume the response writer knows if they can persist or not and sets isKeepAlive on the response
if (!isKeepAlive(response) || !isSelfDefinedMessageLength(response)) {
// No longer keep alive as the client can't tell when the message is done unless we close connection
pendingResponses = 0;
persistentConnection = false;
}
// Server might think it can keep connection alive, but we should fix response header if we know better
if (!shouldKeepAlive()) {
setKeepAlive(response, false);
}
}
if (msg instanceof LastHttpContent && !shouldKeepAlive()) {
promise = promise.unvoid().addListener(ChannelFutureListener.CLOSE);
}
super.write(ctx, msg, promise);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does write() do?
write() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java.
Where is write() defined?
write() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java at line 67.
What does write() call?
write() calls 3 function(s): isSelfDefinedMessageLength, shouldKeepAlive, trackResponse.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free