Interface Request

All Known Implementing Classes:
SimpleRequest

public interface Request
Implementation-agnostic representation of a HTTP request
  • Method Details

    • getPath

      @Nonnull String getPath()
      Returns:
      the request path
    • getMethod

      Returns:
      the HTTP request method ("GET", "PUT" etc.)
    • getBody

      Deprecated.
      use getRequestBody(). This method will be removed in a future release.
      Returns:
      the request body as String
    • getRequestBody

      @Nonnull default Optional<Body> getRequestBody()
      Returns:
      the request body
    • getQueryParameters

      @Nonnull Collection<String> getQueryParameters()
      Returns:
      the collection of query parameter names present on this request
    • getQueryParameterValues

      @Nonnull Collection<String> getQueryParameterValues(String name)
      Get the collection of query parameter values for the query param with the given name.
      Parameters:
      name - The name of the parameter to retrieve. If not differently specified this name is case insensitive.
      Returns:
      The query parameter values for that param; or empty list
    • getHeaders

      Get the collection of headers on this request.

      Result will include key and all values (in the case of multiple headers with the same key)

      Returns:
      The map of key->values for the headers associated with this request.
    • getHeaderValues

      @Nonnull Collection<String> getHeaderValues(String name)
      Get the collection of header values for the header param with the given name.
      Parameters:
      name - The (case insensitive) name of the parameter to retrieve
      Returns:
      The header values for that param; or empty list
    • getHeaderValue

      @Nonnull default Optional<String> getHeaderValue(String name)
      Get the first of header value for the header param with the given name (if any exist).
      Parameters:
      name - The (case insensitive) name of the parameter to retrieve
      Returns:
      The first header value for that param (if it exists)
    • getContentType

      @Nonnull default Optional<String> getContentType()
      Get the content-type header of this request, if it has been set.
      Returns:
      The content-type header, or empty if it has not been set.