Interface HttpServerRequest

All Superinterfaces:
ConnectionInformation, HttpInfos, HttpServerInfos, NettyInbound

public interface HttpServerRequest extends NettyInbound, HttpServerInfos
An Http Reactive Channel with several accessors related to HTTP flow: headers, params, URI, method, websocket...
Since:
0.5
Author:
Stephane Maldini
  • Method Details

    • withConnection

      HttpServerRequest withConnection(Consumer<? super Connection> withConnection)
      Description copied from interface: NettyInbound
      Calls the passed callback with a Connection to operate on the underlying Channel state. This allows for chaining inbound API.
      Specified by:
      withConnection in interface NettyInbound
      Parameters:
      withConnection - connection callback
      Returns:
      the Connection
    • param

      @Nullable String param(CharSequence key)
      URI parameter captured via {} e.g. /test/{param}.
      Parameters:
      key - parameter name e.g. "param" in URI /test/{param}
      Returns:
      the parameter captured value
    • params

      @Nullable Map<String,String> params()
      Returns all URI parameters captured via {} e.g. /test/{param1}/{param2} as key/value map.
      Returns:
      the parameters captured key/value map
    • paramsResolver

      HttpServerRequest paramsResolver(@Nullable Function<? super String,Map<String,String>> paramsResolver)
      Specifies a params resolver.
      Parameters:
      paramsResolver - a params resolver
      Returns:
      this HttpServerRequest
    • receiveContent

      default Flux<HttpContent> receiveContent()
      Returns a Flux of HttpContent containing received chunks.
      Returns:
      a Flux of HttpContent containing received chunks
    • isFormUrlencoded

      boolean isFormUrlencoded()
      Returns true if the request has Content-Type with value application/x-www-form-urlencoded.
      Returns:
      true if the request has Content-Type with value application/x-www-form-urlencoded, false - otherwise
      Since:
      1.0.11
    • isMultipart

      boolean isMultipart()
      Returns true if the request has Content-Type with value multipart/form-data.
      Returns:
      true if the request has Content-Type with value multipart/form-data, false - otherwise
      Since:
      1.0.11
    • receiveForm

      Flux<HttpData> receiveForm()
      When the request is POST and have Content-Type with value application/x-www-form-urlencoded or multipart/form-data, returns a Flux of HttpData containing received Attribute/FileUpload. When the request is not POST or does not have Content-Type with value application/x-www-form-urlencoded or multipart/form-data, a Flux.error(Throwable) will be returned.

      Uses HTTP form decoder configuration specified on server level or the default one if nothing is configured.

      HttpData.retain() disables auto memory release on each HttpData published, retaining in order to prevent premature recycling when HttpData is accumulated downstream.

      Returns:
      a Flux of HttpData containing received Attribute/FileUpload
      Since:
      1.0.11
    • receiveForm

      Flux<HttpData> receiveForm(Consumer<HttpServerFormDecoderProvider.Builder> formDecoderBuilder)
      When the request is POST and have Content-Type with value application/x-www-form-urlencoded or multipart/form-data, returns a Flux of HttpData containing received Attribute/FileUpload. When the request is not POST or does not have Content-Type with value application/x-www-form-urlencoded or multipart/form-data, a Flux.error(Throwable) will be returned.

      HttpData.retain() disables auto memory release on each HttpData published, retaining in order to prevent premature recycling when HttpData is accumulated downstream.

      Parameters:
      formDecoderBuilder - HttpServerFormDecoderProvider.Builder for HTTP form decoder configuration
      Returns:
      a Flux of HttpData containing received Attribute/FileUpload
      Since:
      1.0.11
    • hostAddress

      @Nullable InetSocketAddress hostAddress()
      Description copied from interface: ConnectionInformation
      Returns the address of the host which received the request, possibly null in case of Unix Domain Sockets. The returned address is the merged information from all proxies.
      Specified by:
      hostAddress in interface ConnectionInformation
      Returns:
      the address merged from all proxies of the host which received the request
    • remoteAddress

      @Nullable InetSocketAddress remoteAddress()
      Description copied from interface: ConnectionInformation
      Returns the address of the client that initiated the request, possibly null in case of Unix Domain Sockets. The returned address is the merged information from all proxies.
      Specified by:
      remoteAddress in interface ConnectionInformation
      Returns:
      the address merged from all proxies of the client that initiated the request
    • requestHeaders

      HttpHeaders requestHeaders()
      Returns inbound HttpHeaders.
      Returns:
      inbound HttpHeaders
    • protocol

      String protocol()
      Returns the inbound protocol and version.
      Returns:
      the inbound protocol and version
      Since:
      1.0.28
    • timestamp

      ZonedDateTime timestamp()
      Returns the time when the request was received.
      Returns:
      the time when the request was received
      Since:
      1.0.28
    • forwardedPrefix

      @Nullable String forwardedPrefix()
      Returns the X-Forwarded-Prefix if it was part of the request headers.
      Returns:
      the X-Forwarded-Prefix
      Since:
      1.1.23