Interface Request


public interface Request

Represents a client request in a server exchange.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
Exchange
  • Method Details

    • headers

      RequestHeaders headers()

      Returns the HTTP headers sent in the request.

      Returns:
      the headers
    • queryParameters

      QueryParameters queryParameters()

      Returns the query parameters sent in the request.

      Returns:
      the query parameters
    • cookies

      RequestCookies cookies()

      Returns the cookies sent in the request.

      Returns:
      the cookies
    • getMethod

      Method getMethod()

      Returns the HTTP method of the request.

      Returns:
      the HTTP method
    • getScheme

      String getScheme()

      Returns the name of the scheme used to send the request (eg. http, https...).

      Returns:
      the name of the scheme
    • getAuthority

      String getAuthority()

      Returns the request authority.

      Returns:
      the authority
    • getPath

      String getPath()

      Returns the path to the resource targeted in the request.

      This path corresponds to the origin form as defined by RFC 7230 Section 5.3.1, as such it may contain a query URI component.

      Returns:
      the path to the targeted resource
    • getPathAbsolute

      String getPathAbsolute()

      Returns the absolute path to the resource targeted in the request.

      This path corresponds to the absolute path of the origin form as defined by RFC 7230 Section 5.3.1, as such it only contains the path URI component.

      The resulting path is also normalized as defined by RFC 3986 Section 6.

      Returns:
      the normalized absolute path to the targeted resource
    • getPathBuilder

      URIBuilder getPathBuilder()

      Returns a path builder initialized with the path of the request.

      This method always returns a new URIBuilder instance with URIs.Option.NORMALIZED option. It is then safe to use it to build relative paths.

      Returns:
      a new URI builder
    • getQuery

      String getQuery()

      Returns the query URI component.

      Returns:
      a URI query component
    • getRemoteAddress

      SocketAddress getRemoteAddress()

      Returns the socket address of the client or last proxy that sent the request.

      Returns:
      a socket address
    • body

      Optional<? extends RequestBody> body()

      Returns the request body used to consume request payload.

      Returns:
      an optional returning the request body or an empty optional if the request has no payload