FullHttpResponse() — netty Function Reference
Architecture documentation for the FullHttpResponse() function in WebSocketServerHandshaker07.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e544e828_6988_0f6b_4532_e2e51b3a2f0d["FullHttpResponse()"] 2c62a90c_a2f8_18d2_e63d_025dd7bc93a4["WebSocketServerHandshaker07"] e544e828_6988_0f6b_4532_e2e51b3a2f0d -->|defined in| 2c62a90c_a2f8_18d2_e63d_025dd7bc93a4 style e544e828_6988_0f6b_4532_e2e51b3a2f0d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java lines 131–175
@Override
protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) {
HttpMethod method = req.method();
if (!GET.equals(method)) {
throw new WebSocketServerHandshakeException("Invalid WebSocket handshake method: " + method, req);
}
CharSequence key = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY);
if (key == null) {
throw new WebSocketServerHandshakeException("not a WebSocket request: missing key", req);
}
FullHttpResponse res =
new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS,
req.content().alloc().buffer(0));
if (headers != null) {
res.headers().add(headers);
}
String acceptSeed = key + WEBSOCKET_07_ACCEPT_GUID;
byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));
String accept = WebSocketUtil.base64(sha1);
if (logger.isDebugEnabled()) {
logger.debug("WebSocket version 07 server handshake key: {}, response: {}.", key, accept);
}
res.headers().set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET)
.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.set(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT, accept);
String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL);
if (subprotocols != null) {
String selectedSubprotocol = selectSubprotocol(subprotocols);
if (selectedSubprotocol == null) {
if (logger.isDebugEnabled()) {
logger.debug("Requested subprotocol(s) not supported: {}", subprotocols);
}
} else {
res.headers().set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol);
}
}
return res;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does FullHttpResponse() do?
FullHttpResponse() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java.
Where is FullHttpResponse() defined?
FullHttpResponse() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java at line 131.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free