APISonar


io.netty.handler.codec.http.HttpScheme.HTTP

> io > netty > handler > codec > http > HttpScheme > HTTP
io APIs netty APIs handler APIs codec APIs http APIs HttpScheme APIs HTTP APIs

Example 1
public void handlerAdded(final ChannelHandlerContext ctx) throws Exception {
        super.handlerAdded(ctx);

        // this handler is typically used on an Http2StreamChannel. At this
        // stage, ssl handshake should've been established. checking for the
        // presence of SslHandler in the parent's channel pipeline to
        // determine the HTTP scheme should suffice, even for the case where
        // SniHandler is used.
        final Attribute<HttpScheme> schemeAttribute = connectionSchemeAttribute(ctx);
        if (schemeAttribute.get() == null) {
            final HttpScheme scheme = isSsl(ctx) ? HttpScheme.HTTPS : HttpScheme.HTTP;
            schemeAttribute.set(scheme);
        }
    }
Example 2
private static HttpScheme connectionScheme(ChannelHandlerContext ctx) {
        final HttpScheme scheme = connectionSchemeAttribute(ctx).get();
        return scheme == null ? HttpScheme.HTTP : scheme;
    }
Example 3
public void sendRequest(FullHttpRequest request) {
      HttpResponseHandler responseHandler = initializer.responseHandler();
      int streamId = streamCounter.getAndAdd(2);
      HttpScheme scheme = sslCtx != null ? HttpScheme.HTTPS : HttpScheme.HTTP;

      request.headers().add(HttpHeaderNames.HOST, hostname);
      request.headers().add(HttpConversionUtil.ExtensionHeaderNames.SCHEME.text(), scheme.name());
      request.headers().add(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), streamId);
      responseHandler.put(streamId, channel.write(request), channel.newPromise());
      channel.flush();
   }