LaputaServerHandler.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:laputa 作者:
private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) {
  if (HttpUtil.is100ContinueExpected(req)) {
    ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE));
  }

  if (webSocketPath.equals(req.uri())) {
    WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(
        getWebSocketLocation(req), null, true, MAX_FRAME_PAYLOAD_LENGTH
    );

    handshaker = wsFactory.newHandshaker(req);
    if (handshaker == null) {
      WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel());

    } else {
      handshaker.handshake(ctx.channel(), req);
    }
    return;
  }

  requestProcessor.handleRequest(ctx, req);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号