Class HttpServerConfig


public final class HttpServerConfig extends ServerTransportConfig<HttpServerConfig>
Encapsulate all necessary configuration for HTTP server transport. The public API is read-only.
Author:
Stephane Maldini, Violeta Georgieva, Andrey Shlykov
  • Method Details

    • compressPredicate

      public @Nullable BiPredicate<HttpServerRequest,HttpServerResponse> compressPredicate()
      Return the configured compression predicate or null.
      Returns:
      the configured compression predicate or null
    • cookieDecoder

      @Deprecated public ServerCookieDecoder cookieDecoder()
      Deprecated.
      as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.
      Return the configured ServerCookieDecoder or the default ServerCookieDecoder.STRICT.
      Returns:
      the configured ServerCookieDecoder or the default ServerCookieDecoder.STRICT
    • cookieEncoder

      @Deprecated public ServerCookieEncoder cookieEncoder()
      Deprecated.
      as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.
      Return the configured ServerCookieEncoder or the default ServerCookieEncoder.STRICT.
      Returns:
      the configured ServerCookieEncoder or the default ServerCookieEncoder.STRICT
    • decoder

      public HttpRequestDecoderSpec decoder()
      Return the configured HTTP request decoder options or the default.
      Returns:
      the configured HTTP request decoder options or the default
    • formDecoderProvider

      public HttpServerFormDecoderProvider formDecoderProvider()
      Return the configured HTTP form decoder or the default.
      Returns:
      the configured HTTP form decoder or the default
      Since:
      1.0.11
    • http2SettingsSpec

      public @Nullable Http2SettingsSpec http2SettingsSpec()
      Return the HTTP/2 configuration.
      Returns:
      the HTTP/2 configuration
    • http3SettingsSpec

      public @Nullable Http3SettingsSpec http3SettingsSpec()
      Return the HTTP/3 configuration.
      Returns:
      the HTTP/3 configuration
      Since:
      1.2.0
    • idleTimeout

      public @Nullable Duration idleTimeout()
      Return the configured idle timeout for the connection when it is waiting for an HTTP request or null.
      Returns:
      the configured idle timeout for the connection when it is waiting for an HTTP request or null
    • isForwarded

      public boolean isForwarded()
      Returns whether that HttpServer supports the "Forwarded" and "X-Forwarded-*" HTTP request headers for deriving information about the connection.
      Returns:
      true if that HttpServer supports the "Forwarded" and "X-Forwarded-*" HTTP request headers for deriving information about the connection
    • isSecure

      public boolean isSecure()
      Returns true if that HttpServer secured via SSL transport.
      Returns:
      true if that HttpServer secured via SSL transport
    • maxKeepAliveRequests

      public int maxKeepAliveRequests()
      The configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.
      Returns:
      the configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.
      Since:
      1.0.13
      See Also:
    • minCompressionSize

      public int minCompressionSize()
      Compression is performed once response size exceeds the minimum compression size in bytes.
      Returns:
      the minimum compression size in bytes
    • protocols

      public HttpProtocol[] protocols()
      Return the HTTP protocol to support. Default is HttpProtocol.HTTP11.
      Returns:
      the HTTP protocol to support
    • proxyProtocolSupportType

      public ProxyProtocolSupportType proxyProtocolSupportType()
      Return the supported type for the "HAProxy proxy protocol". The default is ProxyProtocolSupportType.OFF.
      Returns:
      the supported type for the "HAProxy proxy protocol"
    • readTimeout

      public @Nullable Duration readTimeout()
      Return the configured read timeout for the request or null.
      Returns:
      the configured read timeout for the request or null
      Since:
      1.1.9
    • redirectHttpToHttps

      public boolean redirectHttpToHttps()
      Returns true if that HttpServer will redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled. This configuration is applicable only for HTTP/1.x.
      Returns:
      true if that HttpServer will redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled. This configuration is applicable only for HTTP/1.x.
    • requestTimeout

      public @Nullable Duration requestTimeout()
      Return the configured request timeout for the request or null.
      Returns:
      the configured request timeout for the request or null
      Since:
      1.1.9
    • sslProvider

      public @Nullable SslProvider sslProvider()
      Returns the current SslProvider if that HttpServer secured via SSL transport or null.
      Returns:
      the current SslProvider if that HttpServer secured via SSL transport or null
    • uriTagValue

      public @Nullable Function<String,String> uriTagValue()
      Returns the configured function that receives the actual uri and returns the uri tag value that will be used for the metrics with Metrics.URI tag.
      Returns:
      the configured function that receives the actual uri and returns the uri tag value that will be used for the metrics with Metrics.URI tag
    • channelInitializer

      public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer)
      Overrides:
      channelInitializer in class TransportConfig
    • channelType

      protected Class<? extends Channel> channelType(boolean isDomainSocket)
      Overrides:
      channelType in class ServerTransportConfig<HttpServerConfig>
    • defaultLoggingHandler

      protected LoggingHandler defaultLoggingHandler()
      Specified by:
      defaultLoggingHandler in class TransportConfig
    • defaultLoopResources

      protected LoopResources defaultLoopResources()
      Specified by:
      defaultLoopResources in class TransportConfig
    • defaultMetricsRecorder

      protected ChannelMetricsRecorder defaultMetricsRecorder()
      Specified by:
      defaultMetricsRecorder in class TransportConfig
    • defaultOnChannelInit

      protected ChannelPipelineConfigurer defaultOnChannelInit()
      Overrides:
      defaultOnChannelInit in class ServerTransportConfig<HttpServerConfig>
    • loggingHandler

      protected void loggingHandler(LoggingHandler loggingHandler)
      Overrides:
      loggingHandler in class TransportConfig
    • metricsRecorder

      protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder)
      Overrides:
      metricsRecorder in class TransportConfig